in reply to Question on Regular Expression
There is a special form of this construct (look-behind), called "\K" (available since Perl 5.10.0), which causes the regex engine to "keep" everything it had matched prior to the "\K" and not include it in $& ($MATCH). This effectively provides variable-length look-behind. The use of "\K" inside of another look-around assertion is allowed, but the behaviour is currently not well defined.
In Perl v5.18 and earlier, it (${^MATCH}) is only guaranteed to return a defined value when the pattern was compiled or executed with the "/p" modifier. In Perl v5.20, the "/p" modifier does nothing, so "${^MATCH}" does the same thing as $MATCH.The OP is using 5.010.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Question on Regular Expression
by sjain (Initiate) on Dec 27, 2014 at 18:33 UTC | |
by AnomalousMonk (Archbishop) on Dec 27, 2014 at 19:57 UTC | |
by sjain (Initiate) on Dec 28, 2014 at 03:55 UTC | |
by AnomalousMonk (Archbishop) on Dec 28, 2014 at 05:57 UTC | |
by Anonymous Monk on Dec 28, 2014 at 04:41 UTC | |
by sjain (Initiate) on Dec 28, 2014 at 06:02 UTC | |
by sjain (Initiate) on Dec 28, 2014 at 13:13 UTC | |
by AnomalousMonk (Archbishop) on Dec 28, 2014 at 17:33 UTC |