That almost works. The two \n in a row are on new lines.
So it's
\n
\n
intead of \n\n. If that makes any sense.
Jeff Oien
> Or you could just do this:
>
> <?php
> $str = "abc\ndefg\n\nxyzpqr\njklmno";
> $str = ereg_replace("([^\n])\n([^\n])", "\\1 \\2", $str);
> echo $str;
> ?>
>
> That should give you:
>
> abc defg\n\nxyzpqr jklmno
>
> Works by replacing any \n with a space, as long as that \n is not next to
> another \n.
>
>
> Cheers
>
> Simon Garner
>
>
--
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]
- [PHP] Simple String Replace Question Jeff Oien
- Re: [PHP] Simple String Replace Question Chris Adams
- RE: [PHP] Simple String Replace Question Jeff Oien
- Re: [PHP] Simple String Replace Questio... Simon Garner
- Re: [PHP] Simple String Replace Que... Jeff Oien
- Re: [PHP] Simple String Replac... Simon Garner
- RE: [PHP] Simple String Re... Jeff Oien
- Re: [PHP] Simple Strin... Simon Garner
- [PHP] JavaScript Deependra B. Tandukar
- Re: [PHP] JavaScript Robert Gormley
- Re: [PHP] JavaScript Simon Garner
- [PHP] PHP4 directives ... Brian White
- Re: [PHP] PHP4 directi... David Robley
- RE: [PHP] PHP4 directi... PHPBeginner.com
- RE: [PHP] Simple Strin... Jeff Oien

