Search code examples
phpparsingsyntaxpreg-match-allparse-error

Parse error: syntax error, unexpected '('


I am trying, But I get an error

preg_match_all("#href='(.*?)' span class="meta-nav"(.*?)</span>#si",$sonuc[1],$sayfalar);

Parse error: syntax error, unexpected '(' in C:\AppServ\www\wordpress\deneme\deneme.php on line 154

How should I write it?


Solution

  • You have doublequotes inside your regexp, you need to escape them, because they're terminating the string that contains the regexp.

    preg_match_all("#href='(.*?)' <span class=\"meta-nav\">(.*?)</span>#si",$sonuc[1],$sayfalar);