开发者_运维技巧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 the sign ^
?
I'm working with Visual Studio 2008, .NET 3.5, and C#.
You don't need a regex for that. You can simply do this:
myString = myString.Replace("^", "");
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 character.
myString = Regex.Replace(myString, "\^+", String.Empty);
精彩评论