Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Check if a variable contains only one letter?

by DrHyde (Prior)
on May 06, 2014 at 10:38 UTC ( [id://1085158]=note: print w/replies, xml ) Need Help??


in reply to Re: Check if a variable contains only one letter?
in thread Check if a variable contains only one letter?

Or if you don't know what the letter is ...

if($myvar =~ /^([A-Za-z])\1*$/) { ... }

That is, match the beginning of the string, then any letter, then any more of that same letter, then the end of the string. Adapt as appropriate for Unicode abominations.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found