Re: regex on a multi line string
| From: | Gerard Samuel | Date: | Sat, 26 Apr 2003 07:26:22 +0000 |
| Subject: | Re: regex on a multi line string | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145337@lists.php.net to get a copy of this message | ||
Thanks. Its working correctly now...
Salah Faya wrote:
Use the s modifier (PCRE_DOTALL) http://www.php.net/manual/en/pcre.pattern.modifiers.php ----- Original Message ----- From: "Gerard Samuel" <gsam@trini0.org> To: <php-general@lists.php.net> Sent: Saturday, April 26, 2003 9:28 AM Subject: [PHP] regex on a multi line string$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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php