On Friday 29 June 2001 17:27, bill wrote:

> $breaks=preg_match_all("/<br>\s+<br>/i", "$text", $parts)
>
> and this
>
> preg_replace("/<br>\s+<br>/i","</P><P class=\"doserif\">",$text)
>
>
> Now that PHP 4.0.5 has changed the nl2br() function, it no longer
> replaces new lines with:
>
> <br>
>
> but instead with the new XHTML compliant break tags:
>
> <br />
>
> I tried just substituting the new tag into the above regular
> expressions to no avail.  Any ideas?

Lemme guess, you tried

$breaks=preg_match_all("/<br/>\s+<br/>/i", "$text", $parts)

right? As "/" is the pattern delimiter this of course won't work. 
Solution: Escape it:
$breaks=preg_match_all("/<br\/>\s+<br\/>/i", "$text", $parts)
Improved Solution: Make it more flexible:
$breaks=preg_match_all("/<br\s*\/?>\s+<br\s*\/?>/i", "$text", $parts)
That should do the job

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

void sleep(){for(long int sheep=0;!asleep();sheep++);}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to