Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://298710]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2026-01-25 03:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (126 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.