Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: This regexp made simpler

by rubasov (Friar)
on Apr 25, 2010 at 12:48 UTC ( #836779=note: print w/ replies, xml ) Need Help??


in reply to This regexp made simpler

More variations on the theme (if I got it right - the Z is repeated though). The second one does not use captures at all.

while (<DATA>) { print; #s/^A(|\s[^Z]*)Z$/A$1IZ/; s/^A(?:|\s[^Z]*)\K(?=Z$)/I/; print; } __DATA__ AZ AZZ A SOMETHING Z ASOMETHINGZ A Z A ZZ AAZZ AA ZZ


Comment on Re: This regexp made simpler
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2014-09-24 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (244 votes), past polls