Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Help with regular expression

by toolic (Bishop)
on Nov 13, 2014 at 01:45 UTC ( [id://1107041]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Help with regular expression
in thread Help with regular expression

use warnings; use strict; while (<DATA>) { if (/^[a-z]+\s+\d{2}$/i) { print "PASS $_"; } else { print "FAIL $_"; } } __DATA__ xyz 12 45 xyz 123 xyz 12

outputs:

FAIL xyz 12 45 FAIL xyz 123 PASS xyz 12

Replies are listed 'Best First'.
Re^4: Help with regular expression
by heman (Novice) on Nov 13, 2014 at 02:42 UTC
    Thanks toolic :) That works. I guess using boundary made the difference!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-23 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found