Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Stumped by regex

by l.frankline (Hermit)
on Dec 06, 2006 at 15:06 UTC ( [id://588104]=note: print w/replies, xml ) Need Help??


in reply to Stumped by regex

HI,

If the length of the string is greater than 20 then that string is ignored and skipped to next string.

while (<DATA>) { unless (length($_) > 20 ) { if ($_=~m#^[a-zA-Z]+(\s?[a-zA-Z]+)?$#) { print $_ . "\n"; } } } __DATA__ Johnson Larry Wall GeorgeWashingtonBushBush

Results:

Johnson
Larry Wall

Don't put off till tomorrow, what you can do today.

Log In?
Username:
Password:

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

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

    No recent polls found