Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by jeroenes (Priest)
on Oct 12, 2003 at 17:36 UTC ( [id://298676]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print "yes" if not tr/a-zA-Z,//c and not ( str( $_, ',', 0) or str $_,
    + ',' ,-1);
    
  2. or download this
    for (qw/ ,asd asd:asd asd, asd,asd asd,,asd/){
     my $test = $_;
    ...
     print "yes" unless $test=~tr/a-zA-Z,//c or index( $test, ',') == 0 or
    + index( $test, ',') == -1 + length( $test) or index( $test, ',,') > 0
    +;
     print "\n";
     }
    

Log In?
Username:
Password:

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

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

    No recent polls found