Possible Duplicate:
Test if a regular expression is a valid one in PHP
<?php
$subject = "PHP is the web scripting language of choice.";
$pattern = 'sssss';
if(preg_match($pattern,$subject))
{
echo 'true';
}
else
{
echo 'false';
}
?>
The above code gives me warning because the string $pattern
is not a valid regular expression.
If I pass valid regular expression then it works fine.....
How can i check $pattern
is valid regular expression?