Forum Moderators: coopster
$string = '52{1}2';
if (preg_match("/\d+(?={)/", $string, $matches)) {
print "<pre>"; print_r($matches); print "</pre>";
}
Array
(
[0] => 52
)
"An assertion subpattern is matched in the normal way, except that it does not cause the current matching position to be changed. Lookahead assertions start with (?= for positive assertions and (?! for negative assertions. For example,
\w+(?=;)
matches a word followed by a semicolon, but does not include the semicolon in the match..."