[Boulder.pm] perl/HTML/XHTML

Charles Albrecht charlesa at pobox.com
Fri Oct 18 13:00:34 CDT 2002


I go with the octal literals for portability - \r and \n are not equivalent to \015 and \012 on all platforms.

-C

At 11:49 AM -0600 10/18/2002, Keanan Smith wrote:
>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
>_______________________________________________
>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