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

Re: regex: only want [a-zA-Z] and comma chars in a string

by delirium (Chaplain)
on Oct 12, 2003 at 20:56 UTC ( #298710=note: print w/replies, xml ) Need Help??

in reply to regex: only want [a-zA-Z] and comma chars in a string

If you're new to regexes, it might be helpful (although it will slow down processing slightly) to break this down into each thing you are trying to test. That may help you later when coming back to the code to figure out what you were testing for.

For example:

print "$_\n" if !/^,/ && !/,$/ && !/,,/ && /^[a-zA-Z,]$/;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://298710]
and John Coltrane plays...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2018-07-18 01:43 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (383 votes). Check out past polls.