RE: [PHP] Simple String Replace Question

2001-02-26 Thread PHPBeginner.com
AIL PROTECTED]] Sent: Monday, February 26, 2001 3:37 AM To: PHP Subject: [PHP] Simple String Replace Question I would like to get rid of \n characters unless there are two or more in a row. So for example if there is a long email formatted like we do here with line break I want to remove the line br

RE: [PHP] Simple String Replace Question

2001-02-25 Thread Jeff Oien
> > > > > > > > > > $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

Re: [PHP] Simple String Replace Question

2001-02-25 Thread Simon Garner
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

RE: [PHP] Simple String Replace Question

2001-02-25 Thread 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'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",

Re: [PHP] Simple String Replace Question

2001-02-25 Thread Simon Garner
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

RE: [PHP] Simple String Replace Question

2001-02-25 Thread Jeff Oien
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

Re: [PHP] Simple String Replace Question

2001-02-25 Thread Chris Adams
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

Re: [PHP] Simple String Replace Question

2001-02-25 Thread Simon Garner
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

RE: [PHP] Simple String Replace Question

2001-02-25 Thread Jeff Oien
> 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 "$

Re: [PHP] Simple String Replace Question

2001-02-25 Thread Chris Adams
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

[PHP] Simple String Replace Question

2001-02-25 Thread Jeff Oien
I would like to get rid of \n characters unless there are two or more in a row. So for example if there is a long email formatted like we do here with line break I want to remove the line breaks so text can be wrapped by a browser, but also show paragraph breaks where necessary. This is what I ha