PDA

View Full Version : regex including \n


b_hole
02-07-2007, 07:36 PM
I have the following regexp:
$preg_replace("#\|B\-\|(.*?)\|\-B\|#", "<strong>\\1</strong>", $str);
Works ok, but if there's a new line inside the B tags - it doesn't work (remains the same as without the replace). Why? How can I fix this?

Thanks :thumbsup:

marek_mar
02-07-2007, 07:59 PM
By default the dot doesn't match newline characters. Add the s modifier to the regex.

b_hole
02-07-2007, 08:19 PM
Thanks, marek_mar :)