Forum Moderators: coopster
$body = $_REQUEST['body'];$pattern = '\n';
$replace = '</LB><LB>';
$body = ereg_replace($pattern , $replace , $body);
Actually, I'd like to replace any number of line breaks (it could be one, it could be 50) with "\n</LB><LB>"
This is probably pretty simple, but I'm new at this, so any pointers would be helpful.
[edited by: coopster at 3:28 pm (utc) on July 14, 2006]
[edit reason]
[1][edit reason] removed link [/edit] [/edit][/1]
$pattern = '\n';
$pattern = "\n";
How about this? Say I have 20 line breaks between text. I don't want to replace that with
\n</LB></LB>
\n</LB></LB>
\n</LB></LB>
\n</LB></LB> ... etc.
Even if there's 20, I just want to replace it with one \n</LB></LB> What should I be looking for? I thought that it should be "\n+", but that would give me 20, and I just want one. Ideas?
Here's what I have now...
$pattern = "/(\r\n)+/";
$replace = "\n</LB><LB>";$body = preg_replace("$pattern","</LB><LB>",$body);
I still do have one issue, however. The output doesn't put in my new line before each </LB><LB>. Am I doing something wrong there?