Re: Removing Empty Lines from Text??
| From: | Tracker 1 | Date: | Mon, 24 Jun 2002 09:42:03 +0000 |
| Subject: | Re: Removing Empty Lines from Text?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103595@lists.php.net to get a copy of this message | ||
$strMine = preg.replace("/(\r\n|\r|\n)+/",$strMine,"\r\n\r\n");
or "\n\n" as the replace.. :)
I use the (\r\n|\r|\n) to match against windows, unix, & mac line
terminations... I usually replace with the windows \r\n
--
=======================================================================
Michael J. Ryan - tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net
telnet://theroughnecks.net
=======================================================================
Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
One program for aim/icq/yahoo/msn/irc - http://www.trillian.cc/
"Jason Caldwell" <jason@thinkingman.org> wrote in message...
> Is there an elegant way to remove excess blank lines from my form data?
>
> For example; if someone enters the following text and then press' the
> Submit button:
>
> ----
> This is a some text
>
>
> This is more text, and yet even more....
> ----
>
> What I want to do is remove the excess white space and make it look like
> this?
>
> ----
> This is a some text
>
> This is more text, and yet even more....
> ----
>
> My users may press <enter> too many times and I want to ensure clean text
> and formatting.
>
> Thanks.
> Jason
>
>
>
>