Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Range of chars except one

by Anonymous Monk
on Jan 21, 2002 at 03:12 UTC ( [id://140264]=note: print w/replies, xml ) Need Help??


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/)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://140264]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found