Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://298710]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2017-12-14 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (414 votes). Check out past polls.

    Notices?