在.NET中使用正则表达式,模式为^%[^%]+%\Z
和字符串为"few)few%"
我收到错误 - System.ArgumentException: parsing "few)few%" - Too many)'s
。Reg Ex解析错误 - 太多了)的
Dim match As System.Text.RegularExpressions.Match = System.Text.RegularExpressions.Regex.Match("^%[^%]+%\Z", "few)few%")
问题是什么?我是否需要在任何输入表达式中转义括号来注册ex?
(我想在确定字符串的通配符%的开头和字符串的结尾而不是字符串中的其他地方)
我可能是错误的,但它看起来像你也许应该逃避你的字符串与另一个反斜杠反斜杠? – slartibartfast 2010-04-16 08:21:39
@slartibartfast:显然,在Visual Basic中这不是必需的。 – 2010-04-16 11:00:18