Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: A Regex simple Question

by FunkyMonk (Chancellor)
on Sep 06, 2007 at 15:52 UTC ( [id://637463]=note: print w/replies, xml ) Need Help??


in reply to A Regex simple Question

I'd split it into two matches:
while ( <DATA> ) { chomp; print "$_: ", /^a.*b$/ && !/.ab./ ? "yes" : "no", "\n"; } __DATA__ a000000000b a0a0000b00b a0000ab000b ab00000000b a000ab

Output:

a000000000b: yes a0a0000b00b: yes a0000ab000b: no ab00000000b: yes a000ab: yes

update: Added two more tests cases and fixed a bug

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://637463]
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-04-19 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found