Would
$string_new = ereg_replace("\n[ \t\r\n]*\n", "\n", $string);
work for you?
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-Original Message-
From: Jeff Oien [mailto:[EMAIL PROTECTED]]
Sent: M
>
>
>
>
>
>
>
>
>
> $str = ereg_replace("([^\r\n])\r\n([^\r\n])", "\\1 \\2", $str);
> echo $str;
> ?>
>
>
>
>
Got it now. I didn't didn't have tags in mine. With
the tags it works as prescribed. Thanks! The other
troubleshooting examples were helpful too to know what's
go
From: "Jeff Oien" <[EMAIL PROTECTED]>
> Ok now I'm really being a pest. Your code works on your
> example but not on mine. I can't figure out why. But I really
> appreciate the help so far from Chris and Simon so thanks.
>
> Here is my example and what happens when I use your
> code. I tried it b
> No, that doesn't make any sense whatsoever :)
>
> A \n *is* a new line. I can only guess you're getting confused because
> there's \r's as well as \n's in the string. Try this:
>
>
> $str = "abc\r\ndefg\r\n\r\nxyzpqr\r\njklmno";
> $str = ereg_replace("([^\r\n])\r\n([^\r\n])", "\\1 \\2",
From: "Jeff Oien" <[EMAIL PROTECTED]>
> 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
No, that doesn't make any sense whatsoever :)
A \n *is* a new line. I can only guess you're getting confused because
there
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:
>
> $str = "abc\ndefg\n\nxyzpqr\njklmno";
> $str = ereg_replace("([^\n])\n([^\n])", "\\1 \\2", $str);
> echo $str;
> ?>
>
> That sh
On 25 Feb 2001 14:37:02 -0800, Jeff Oien <[EMAIL PROTECTED]> wrote:
>> On 25 Feb 2001 10:34:27 -0800, Jeff Oien <[EMAIL PROTECTED]> wrote:
>> >I would like to get rid of \n characters unless there
>> >are two or more in a row. So for example if there
>>
>> The Perl-compatible regular expressions
From: "Jeff Oien" <[EMAIL PROTECTED]>
> > On 25 Feb 2001 10:34:27 -0800, Jeff Oien <[EMAIL PROTECTED]> wrote:
> > >I would like to get rid of \n characters unless there
> > >are two or more in a row. So for example if there
> >
> > The Perl-compatible regular expressions support lookahead and loo
> On 25 Feb 2001 10:34:27 -0800, Jeff Oien <[EMAIL PROTECTED]> wrote:
> >I would like to get rid of \n characters unless there
> >are two or more in a row. So for example if there
>
> The Perl-compatible regular expressions support lookahead and look behind:
>
> $str = 'abcdefabcaadd';
> echo "$
On 25 Feb 2001 10:34:27 -0800, Jeff Oien <[EMAIL PROTECTED]> wrote:
>I would like to get rid of \n characters unless there
>are two or more in a row. So for example if there
The Perl-compatible regular expressions support lookahead and look behind:
$str = 'abcdefabcaadd';
echo "$str\n";
$str = p
10 matches
Mail list logo