Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 studying the Monastery: (11)
As of 2015-07-06 21:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (83 votes), past polls