tags:

views:

88

answers:

2

I want to filter out the char ^ before searching something in a database. What will my regular expression look like if i want to achieve that the query will ignore this sign: ^ ? I'm working with VS2008 .net 3.5 and C#.

+9  A: 

You don't need a regex for that, you can simply do this:

myString = myString.Replace("^","");
BFree
I thought a regex would be better ;) thanks tho!
Younes
+1  A: 

If you want to filter only that character a simple String.Replace() call would suffice. Anyway, if you want to use a Regular expression you must escape the ^, since it is a special char.

myString = Regex.Replace(myString, "\^+", String.Empty);

mamoo