Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Regular expressions are <a href="http://www.skdevelopment.com/php-regular-expressions.php" rel="nofollow noreferrer">greedy</a> by default (at least PCREs). Usually you could circumvent this:</p> <pre><code>/a+/ # selects the whiole string from "aaaaaaa" /a+?/ # selects only "a" </code></pre> <p>In your case, this doesn't help much, since you can't just throw in a question mark somewhere. The only possibility is to <strong>re-order</strong> your search array and instantly <strong>replace</strong> the found places. Search <strong>first</strong> for <code>s:10</code> and <strong>second</strong> for <code>s:1</code>, and use <a href="http://php.net/preg_replace" rel="nofollow noreferrer">preg_replace()</a> instead of the matching. This way, the second doesn't find the first anymore.</p> <p><strong>Another possibility:</strong> Split your search array in two. If you know, that the one always has the structure 's:' plus digits, you could have your regexp in this second loop like</p> <pre><code>Preg_Match_All ( '/' . Preg_Quote ( $smilie ) . '(?![0-9])/i', $Content, $matches ); </code></pre> <p>with <code>(?![0-9])</code> a <a href="http://de.php.net/manual/en/regexp.reference.assertions.php" rel="nofollow noreferrer">look ahead expression</a> looking for any <em>non</em>-digit.</p> <p><strong>And a third one:</strong> If you allow (== convert) smileys only at certain places, you could use this:</p> <pre><code>Preg_Match_All ( '/\b' . Preg_Quote ( $smilie ) . '\b/i', $Content, $matches ); </code></pre> <p><code>\b</code> is a "word boundary", usually any not-(letter, digit, underscore). Drawback is obviously, that not all smileys (like "abc;-)xyz") will be found.</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