- preg_match: documentation ( source)
- preg_last_error: documentation ( source)
<?php
preg_match('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar');
if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) {
echo 'Backtrack limit was exhausted!';
}
if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) {
echo 'Backtrack limit was exhausted!';
}