当前位置: 代码迷 >> ASP.NET >> 正则表达式.字符里有括号咋匹配?比如:l like the(123)
  详细解决方案

正则表达式.字符里有括号咋匹配?比如:l like the(123)

热度:7760   发布时间:2013-02-25 00:00:00.0
求一个正则表达式.字符里有括号咋匹配?比如:l like the(123)
l like the(123)
l like the(12)
l like the(333)
l like the(55)
l like the(567)
只有括号中的在变.这样的咋匹配出来?

------解决方案--------------------------------------------------------
是取括号里的东西吗?
------解决方案--------------------------------------------------------
用正则,很简单的
String pattern=@"l like the\(\d*)";



------解决方案--------------------------------------------------------
C# code
@"I like the \([^)]+\)"
------解决方案--------------------------------------------------------
\转义字符即可
@"I like the \([^)]+\)"