---
title: "Regular Expression pattern issue"  
description: "Regular Expression pattern issue"  
author: "Manoj Bhatt"  
published: 2013-12-27  
updated: 2013-12-27  
canonical: https://www.mindstick.com/forum/1849/regular-expression-pattern-issue  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Regular Expression pattern issue

I want to [delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) all the [characters](https://answers.mindstick.com/qa/42112/who-is-the-originator-of-avengers-characters) other than letter and number from a given [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp). I used the [pattern](https://www.mindstick.com/forum/2314/what-is-the-mvp-and-mvc-pattern) below but it still returns string without any change.

[Regex](https://www.mindstick.com/forum/160352/how-to-use-regex-in-javascript-for-pattern-matching) rex = new Regex("/[^a-zA-Z0-9]+/");

[Response.Write](https://www.mindstick.com/forum/1031/response-write-doesn-t-display-image)(rex.Replace("asd123!-<>@;',.", ""));

It suppose to return "asd123"

Regex patterns are like alien [language](https://www.mindstick.com/startup/28/preply-the-fast-growing-platform-transforming-language-learning) to me and I dont know how to [fix](https://yourviews.mindstick.com/view/80763/donald-trump-ki-jeet-fix-hai) this.

Thanks

## Replies

### Reply by Anonymous User

Hi Manoj,

In C#, you don't need to delimit regex patterns with / characters.

## Try this:

```
Regex rex = new Regex("[^a-zA-Z0-9]+");Response.Write(rex.Replace("asd123!-<>@;',.",
""));
```


---

Original Source: https://www.mindstick.com/forum/1849/regular-expression-pattern-issue

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
