[Boulder.pm] perl/HTML/XHTML

Charles Albrecht charlesa at pobox.com
Fri Oct 18 12:37:21 CDT 2002


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



More information about the Boulder-pm mailing list