0

Let's say I have:

$pattern = "/a/";
$string = 'Jack is a boy';
preg_match( $pattern, $string, $matches );

How do I perform a global search asfter the fitst a. I know in JavaScript one uses the 'g' letter. What about PHP?

Robert
  • 10,126
  • 19
  • 78
  • 130
  • 3
    php uses the [preg_match_all](http://www.php.net/preg_match_all) function to match with the `g` modifier. And in [preg_replace](http://www.php.net/preg_replace) the global modifier is assumed which is why there is a limit argument. – Jonathan Kuhn Oct 07 '14 at 21:38
  • What is your expected result? – Toto Oct 08 '14 at 11:05

0 Answers0