chuck taylor
chuck taylor

Reputation: 2516

C# regular expression '+' character

How do I use C# regular expressions to search for special characters (like '+' in this case)?

I would usually just use + in perl / ruby, but I can't seem to figure out how to do this in C#. Thanks for any help you can provide.

Upvotes: 0

Views: 320

Answers (2)

Jens
Jens

Reputation: 25563

Backslashes work fine. As an alternative, you could use a character class for this and use [+] to match "+".

Upvotes: 0

Homde
Homde

Reputation: 4286

use backslash to escape special characters

Upvotes: 5

Related Questions