警告:preg_match():未知的修饰符''in

时间:2012-07-10 09:49:54

标签: php regex preg-match

我不明白有什么问题,我怎么能对这个简单的正则表达式有这个错误。 我可以输入任何我想要的东西,它总会给我同样的错误。在消息本身中,它没有显示哪个修饰符导致问题,修饰符只是空的。

public function getRows($content) {
    $regex = '/[a-z]+/';
    preg_match($content, $regex, $rows);
    print_r($rows); exit;
    return $return;
}

1 个答案:

答案 0 :(得分:3)

第一个参数是正则表达式,第二个是主题:

  

int preg_match(string $ pattern,string $ subject ...

来自preg_match() in the Manual

所以这应该可以正常工作:

preg_match($regex, $content, $rows);