| Posted by Mig21 on 05/16/05 03:04 
hi
 i am trying to make a bbcode parser and i get stuck at this :(
 
 i want to replace all '\n' with "<br />\n" in a text unless it's in
 between <pre></pre> tags. i can't figure out a way to conditionally
 replace anything.
 
 for example, this text:
 ---
 some text here
 <pre>some
 more
 text here     !</pre>
 outside
 lala
 ---
 
 would become, if it was working:
 ---
 some text here<br />
 <pre>some
 more
 text here     !</pre>
 outside<br />
 lala<br />
 ---
 
 now all i have is:
 $step4 = preg_replace("#\n#is", "<br />\n", $step3);
 
 which replaces all newlines, even inside <pre>
 
 please help!
 [Back to original message] |