in reply to Range of chars except one

I'm supprised no one has suggested a more complex range, try something like this:
$startCh = chr(0); $midstopCh = chr(9); $midstartCh = chr(11); $endCh = chr(31); $text =~ s/[$startCh-$midstopCh,$midstartCh-$endCh]//g;
which should work just fine, although I haven't tested it for speed. You can jsut keep specifing more ranges for those chars you wish to exclude, although it becomes rather clunky looking if you have a large number of ranges.

CAVEMAN

Replies are listed 'Best First'.
Re: Re: Range of chars except one
by IlyaM (Parson) on Jan 21, 2002 at 05:04 UTC
    Beware of ',' (comma) in this regexp. It should not be there. Otherwise all commas will be stripped from $text.

    Update:

    I'm supprised no one has suggested a more complex range

    Actually Juerd's reply does suggest solution which uses complex range.

    --
    Ilya Martynov (http://martynov.org/)