Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 lurking in the Monastery: (5)
As of 2019-04-22 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I am most likely to install a new module from CPAN if:
















    Results (112 votes). Check out past polls.

    Notices?