[Boulder.pm] perl/HTML/XHTML

Keanan Smith KSmith at netLibrary.com
Fri Oct 18 12:49:16 CDT 2002


Err That should have been:
s/[\r\n]+/\n/go;

-----Original Message-----
From: Charles Albrecht [mailto:charlesa at pobox.com]
Sent: Friday, October 18, 2002 11:37 AM
To: boulder-pm at mail.pm.org
Subject: Re: [Boulder.pm] perl/HTML/XHTML


At 11:09 AM -0600 10/18/2002, Walter Pienciak wrote:
>Howdy, and welcome to the almost-weekend.
>
>For a web-upload mechanism of mine, I'm adding QC modules that
>check/delete pesky Control-M's and whack excessive amounts of
>empty lines.
>
>Now, with the file contents in $Content, the first is easy:
>
> $Content =~ s/^M//go;

For this step, how about the standard line ending switcher (since ctrl-M -
Carriage Return - is \015):

$Content =~ s/(\015\012|\012|\015)/\n/go;

>But the second, hrmmm.  Because if someone is uploading a file
>with preformatted content, we DON'T want to whack those newlines.

Keenan's regex looks great for this.

-Charles
 Euonymic Solutions
 charlesa at pobox.com
_______________________________________________
Boulder-pm mailing list
Boulder-pm at mail.pm.org
http://mail.pm.org/mailman/listinfo/boulder-pm



More information about the Boulder-pm mailing list