in reply to Check if a variable contains only one letter?
if ($myvar =~ /^[^A-VYZ]*(X+[^A-VYZ]*)+$/) { print "Error\n"; }
This should let you match things like 9XX35X7 and still reject AXXBXC.
Update: It's really too bad that I don't know the alphabet, and I inadvertently left W out. ww pointed it out to me, and I didn't intentionally omit him!
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|