Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Check if a variable contains only one letter?

by oiskuu (Hermit)
on May 02, 2014 at 18:10 UTC ( #1084832=note: print w/replies, xml ) Need Help??


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

To test if a variable contains a repeat sequence of some letter, any one letter:

if ($myvar =~ /^([[:alpha:]])\1*\z/) { ... }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1084832]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2017-07-27 14:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (416 votes). Check out past polls.