A
Arnshea
There's an article (well, an editor's update to an article - at
http://msdn.microsoft.com/msdnmag/issues/04/06/NETMatters/#edupdate )
that presents the following regular expression for detecting balanced
brackets.
string pattern =
@"^((?<openBracket>\{) | [^\{\}] |" +
@"(?<closeBracket-openBracket>\}))*" +
@"(?(openBracket)(?!))$";
What is the purpose of the last line? Shouldn't
^((?<openBracket>\{) | [^\{\}] | (?<closeBracket-openBracket>\}))*$
be sufficient?
http://msdn.microsoft.com/msdnmag/issues/04/06/NETMatters/#edupdate )
that presents the following regular expression for detecting balanced
brackets.
string pattern =
@"^((?<openBracket>\{) | [^\{\}] |" +
@"(?<closeBracket-openBracket>\}))*" +
@"(?(openBracket)(?!))$";
What is the purpose of the last line? Shouldn't
^((?<openBracket>\{) | [^\{\}] | (?<closeBracket-openBracket>\}))*$
be sufficient?