note 79851 deleted from function.preg-match by felipe
| From: | felipe@php.net | Date: | Sun, 16 Dec 2007 00:50:14 +0000 |
| Subject: | note 79851 deleted from function.preg-match by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133604@lists.php.net to get a copy of this message | ||
Note Submitter: bjorn dot padding at gmail dot com
Reason: 1
----
in addition to vladimir at pixeltomorrow dot com.
Here is a shorter way of checking if your regular expression is syntactically correct.
<?
function preg_test($regex)
{
if (sprintf("%s",@preg_match($regex,'')) == '')
{
$error = error_get_last();
throw new Exception(substr($error['message'],70));
}
else
return true;
}
?>
Cheers,
Bjorn Padding