Marcello has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I use the following regexp to remove all unwanted characters (ord 0..31)
I know I could do
TIA!
This works fine, but I want to preserve the newlines (ord 10). Is there any way to specify elements in the regexp which should NOT be included in the specified range?my $startCh = chr(0); my $endCh = chr(31); $text =~ s/[$startCh-$endCh]//g;
I know I could do
but then I run into problems when I want to exclude another character.$startCh = chr(0); $endCh = chr(9); $text =~ s/[$startCh-$endCh]//g; $startCh = chr(11); $endCh = chr(31); $text ==~ s/[$startCh-$endCh]//g;
TIA!
Back to
Seekers of Perl Wisdom