Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by DrHyde (Prior)
on May 06, 2014 at 10:38 UTC ( #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
Node Status?
node history
Node Type: note [id://1085158]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2020-10-25 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (249 votes). Check out past polls.

    Notices?