Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^5: RegExp: pos management in global substitution

by AnomalousMonk (Canon)
on Sep 04, 2011 at 18:41 UTC ( #924110=note: print w/replies, xml ) Need Help??

in reply to Re^4: RegExp: pos management in global substitution
in thread RegExp: pos management in global substitution

The implied specification of Re^4: RegExp: pos management in global substitution can be met by changing the regex sub-expression (actually, it happens to be the whole regex)
    (?: \G (?<! ^) | ^ \{ name_a) $param_xy*+ \K $param_any
    (?: \G (?<! \A) | \{ name_a) $param_xy*+ \K $param_any
in the function  xform() of Re: RegExp: pos management in global substitution (see Update 2).

OK, so what's the next specification increment? Totally arbitrary embedded whitespace, including newlines? Bring it on!

BTW: The discussion of the "\G assertion" in the Regexp Quote Like Operators section of perlop includes the disquieting warning 'Note also that, currently, "\G" is only properly supported when anchored at the very beginning of the pattern.' (emphasis added). I don't understand all the implications of this restriction, but I strive diligently, perhaps slavishly and superstitiously, to heed it, even making sure that in a regex expression like
    \G (?<! \A)
(end of last match except when at absolute start of string) the  \G assertion appears at the very start of the regex. I mention this because I noticed the expression
    (?:\{name_a | \G)
in your code and I don't know its possible effect(s). You have been warned!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://924110]
[finddata]: How do i perform multiple line substitution into single line for same variable using perl

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2017-02-24 05:59 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (352 votes). Check out past polls.