System.Text.RegularExpressions.Regex.Escape()disappears only when braces are opened. Is there a .NET Framework method that speeds up closing braces for use in regex? I can't seem to find. I would not like to hard code characters.
System.Text.RegularExpressions.Regex.Escape()
edit . I need to generate tags (? <-Open>) to determine group balancing. I get a list of characters representing the closing delimiters, avoid them, and then add them to the expression in the "(? <-Open>)" tags. So yes, I really need to avoid trailing brackets.
, Escape (MSDN):
(\, *, +,?, |, {, [, (,), ^, $,., # ), escape-. , .
:
Escape ([) ({), (] }). . , . , . , , (). . "".
, }, {, .
}
{
Regex.Escape . - ? , . , , , , .
FWIW, Regex.Escape() :
Regex.Escape("(Hello)"); // \(Hello\) Regex.Escape("Hello)"); // Hello\) Regex.Escape("(Hello"); // \(Hello
: , , , {, , . Regex.Escape() , , , , , . , : 1) , , 2) , -, Regex.Escape .