in reply to regex: only want [a-zA-Z] and comma chars in a string
Hi heezey,
Why not try without regex?
Did not check it but should work.print "yes" if not tr/a-zA-Z,//c and not ( str( $_, ',', 0) or str $_, + ',' ,-1);
Cheers,
Jeroen "We are not alone"(FZ)
After some self-flaggalation:
for (qw/ ,asd asd:asd asd, asd,asd asd,,asd/){ my $test = $_; print "$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"; }
My perl clearly is rusty, and I even don't know anymore in which language str is valid ;).
However, still possible without regexes {grin}.
In Section
Seekers of Perl Wisdom