Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>UPDATE</strong></p> <p><strong>\G</strong> forces the pattern to only return matches that are part of a continuous chain of matches. From the first match each subsequent match must be preceded by a match. If you break the chain the matches end.</p> <pre><code>&lt;?php $pattern = '#(match),#'; $subject = "match,match,match,match,not-match,match"; preg_match_all( $pattern, $subject, $matches ); //Will output match 5 times because it skips over not-match foreach ( $matches[1] as $match ) { echo $match . '&lt;br /&gt;'; } echo '&lt;br /&gt;'; $pattern = '#(\Gmatch),#'; $subject = "match,match,match,match,not-match,match"; preg_match_all( $pattern, $subject, $matches ); //Will only output match 4 times because at not-match the chain is broken foreach ( $matches[1] as $match ) { echo $match . '&lt;br /&gt;'; } ?&gt; </code></pre> <p>This is straight from the docs</p> <blockquote> <p>The fourth use of backslash is for certain simple assertions. An assertion specifies a condition that has to be met at a particular point in a match, without consuming any characters from the subject string. The use of subpatterns for more complicated assertions is described below. The backslashed assertions are</p> </blockquote> <pre><code> \G first matching position in subject </code></pre> <blockquote> <p>The \G assertion is true only when the current matching position is at the start point of the match, as specified by the offset argument of preg_match(). It differs from \A when the value of offset is non-zero.</p> </blockquote> <p><a href="http://www.php.net/manual/en/regexp.reference.escape.php" rel="nofollow noreferrer">http://www.php.net/manual/en/regexp.reference.escape.php</a> </p> <p>You will have to scroll down that page a bit but there it is.</p> <p>There is a really good example in ruby but it is the same in php.</p> <p><a href="https://stackoverflow.com/questions/14365969/how-the-anchor-z-and-g-works-in-ruby/14366062#14366062">How the Anchor \z and \G works in Ruby?</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload