regex on a multi line string
| From: | Gerard Samuel | Date: | Sat, 26 Apr 2003 06:28:30 +0000 |
| Subject: | regex on a multi line string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-145335@lists.php.net to get a copy of this message | ||
$foo = '[quote]This is a quote[/quote]';
if (preg_match('/\[quote\].*?\[\/quote\]/', $foo))
{
echo 'match found';
}
else
{
echo 'match not found';
}
-----------------------
For the given value of $foo, this regex works as advertised.
If $foo is a multiline string as in ->
$foo = '[quote]
This
is
a
quote
[/quote]';
the regex doesn't match.
What can be done to the regex, where it will match both single and multiline strings?
Thanks for you advice.