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

Re^5: Regex fun

by JadeNB (Chaplain)
on Dec 16, 2009 at 15:57 UTC ( [id://813028]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Regex fun
in thread Regex fun

It still didn't work as needed. That didn't remove the bases after the +N.

I guess you mean the s/// while s/// code in Re^3: Regex fun? Yes, I know it doesn't work, but was just posting it as an example of what would work if Perl changed to fit my whims. :-) I should probably make that clearer.

The actual fixed-but-inelegant code is in Re: Regex fun, in an update at the bottom. I tested it on your input, and it seemed to give the desired output. (It doesn't handle -N escapes, which you seem to want, because I didn't see anything about that in your original specification; but it would be easy enough to adapt it.)

pos($_) -= length($1)+1;

You may want to try pos = $-[0] instead. See pos (for implicit action on $_) and @-.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-24 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found