Reg Ex parsing error - too many )'s

Posted by Chris Herring on Stack Overflow See other posts from Stack Overflow or by Chris Herring
Published on 2010-04-16T08:04:52Z Indexed on 2010/04/16 8:13 UTC
Read the original article Hit count: 1609

Filed under:
|

Using regular expressions in .NET with the pattern ^%[^%]+%\Z and the string "few)few%" I get the error - System.ArgumentException: parsing "few)few%" - Too many )'s.

Dim match As System.Text.RegularExpressions.Match = System.Text.RegularExpressions.Regex.Match("^%[^%]+%\Z", "few)few%")

What would the issue be? Do I need to escape brackets in any input expression to reg ex?

(I'm trying the determine if string has the wildcard % at the beginning and end of the string but not elsewhere in the string)

© Stack Overflow or respective owner

Related posts about regex

Related posts about .NET