Php preg_match_all:警告:preg_match_all():未知修饰符';(';in
可能重复:Php preg_match_all:警告:preg_match_all():未知修饰符';(';in,php,regex,preg-match,preg-match-all,Php,Regex,Preg Match,Preg Match All,可能重复: 我正在尝试匹配这种模式 $regex_pattern = '<td id="(\w+)" class="(\w+)">(\w+).com<\/td>'; preg_match_all($regex_pattern, $result, $matches); print_r($matches); $regex_pattern='(\w+.com'; preg_match_all($regex_pattern,$result,$matches); 打印(匹
我正在尝试匹配这种模式
$regex_pattern = '<td id="(\w+)" class="(\w+)">(\w+).com<\/td>';
preg_match_all($regex_pattern, $result, $matches);
print_r($matches);
$regex_pattern='(\w+.com';
preg_match_all($regex_pattern,$result,$matches);
打印(匹配项);
但我得到了这个错误:警告:preg_match_all():中的未知修饰符“(”
我的正则表达式模式出了什么问题?
在使用PCRE函数时,要求图案用分隔符括起来。分隔符可以是任何非字母数字、非反斜杠、非空白字符
常用的分隔符有正斜杠(/)、散列符号(#)和波浪号(~)
$regex_pattern='/(\w+).com/;
preg_match_all($regex_pattern,$result,$matches);
打印(匹配项);
在使用PCRE函数时,要求图案用分隔符括起来。分隔符可以是任何非字母数字、非反斜杠、非空白字符
常用的分隔符有正斜杠(/)、散列符号(#)和波浪号(~)
$regex_pattern='/(\w+).com/;
preg_match_all($regex_pattern,$result,$matches);
打印(匹配项);
$regex_pattern = '/<td id="(\w+)" class="(\w+)">(\w+).com<\/td>/';
preg_match_all($regex_pattern, $result, $matches);
print_r($matches);