develooper Front page | perl.macperl.webcgi | Postings from January 2003

Re: [MacPerl-WebCGI] Filtering the input from a transmitet form

Thread Previous | Thread Next
From:
Thomas De Groote
Date:
January 10, 2003 10:17
Subject:
Re: [MacPerl-WebCGI] Filtering the input from a transmitet form
Message ID:
C0F678DC-24C7-11D7-97EC-000393CD61CA@rug.ac.be
Didn't see you also want to filter white space, use this to achieve the 
whole thing :

$data =~ s/[\n\r][\n\r]/<br>/g; # Filters the line breaks
$data =~ s/^\s+//;	# Filters out white space in front
$data =~ s/\s+$//;	# Filters out white space in end
$data =~ s/\s+/ /g;	# Filters out double white spaces and makes it a 
single space.


Maybe that can all be joined a little more, but this is clearer code (I 
think).

Greetz,

Thomas


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About