Kim Madsen wrote:
Michael A. Peters wrote on 26/01/2010 14:18:
$fixSrch[] = '/\n/';
$fixRplc[] = '[br]';
is what I need except I want it to leave anything between [code] and
[/code] alone.
I figured it out before but with <element> </element> but I don't even
remember what I was working on when I did that and I can't for the
life of me find it now.
Just use the function nl2br()
If you wanna match "\n", you need to add a backslash before the
backslash: "\\n"
No, I do NOT want to use nl2br.
For one thing, nl2br isn't xml safe so I'd have to do another
preg_replace to fix that. My bbcode parser is xml safe.
For another thing, my bbcode parser doesn't like html in its input, and
this needs to be done before the parser.
'/\n/','[br]'
works exactly as I want it to right now except I do not want it replace
the newlines inside [code][/code] as that messes up the syntax
highlighting that is then done one the code block.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php