Re: [MacPerl-WebCGI] Filtering the input from a transmitet form
[email protected] (Thomas De Groote) Fri, 10 Jan 2003 19:17:18 +0100
| Newsgroups | perl.macperl.webcgi |
|---|---|
| Message-ID | <[email protected]> |
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