【发布时间】:2010-05-04 17:43:44
【问题描述】:
我正在尝试从 php 中的字符串中获取一些东西。在 RegexBuddy 和正则表达式测试器(firefox 插件)中效果很好,但是 php 给了我以下内容:
警告:preg_match() [function.preg-match]:编译 失败:不匹配的括号在 偏移 34 英寸 D:\路径\example.php 在第 62 行
我的模式是"/.{4}_tmp\\([A-Za-z0-9.\\]*)\(([0-9]*)\) : (.*)/i"
示例字符串:C:\Temp\browseide\projects\32\821C_tmp\SourceFiles\main.c(8) : error C2143: syntax error : missing ';' before 'for'
RegexBuddy 得到什么:
821C_tmp\SourceFiles\main.c(8) : error C2143: syntax error : missing ';' before 'for'
Group 1: SourceFiles\main.c
Group 2: 8
Group 3: error C2143: syntax error : missing ';' before 'for'
【问题讨论】:
标签: php regex preg-match