H2ONaCl
H2ONaCl

Reputation: 11279

.NET regular expression reserved characters

Where is the set of .NET regular expression reserved characters?

Edit: This looks like it might be it. Thanks sugarman. http://msdn.microsoft.com/en-us/library/az24scfc.aspx

Upvotes: 4

Views: 949

Answers (3)

H2ONaCl
H2ONaCl

Reputation: 11279

This link goes to the exact page that answers the question. (The answer comes from sugarman. If sugarman wants to post the answer it will be selected.)

character escapes supported by regular expressions in the .NET Framework

From that link there is a table entry that says, .NET regular expression chars match themselves except for the following:

. $ ^ { [ ( | ) * + ? \

Thus, these are the reserved chars of .NET regular expressions.

Upvotes: 2

Jarrod Christman
Jarrod Christman

Reputation: 390

You should look at Regex.Escape(). You pass the function a string and it will escape any reserved regex characters to be interpreted as literals. Credit to this answer goes to Gabe who commented on the OP's post, I'm just making it an answer so others don't possibly miss it.

Upvotes: 3

Jeff Swensen
Jeff Swensen

Reputation: 3573

This is probably a good starting point for what you're looking for:

.NET Framework Regular Expressions

Upvotes: 1

Related Questions