
April 21st, 2008, 06:19 PM
|
|
|
When in doubt, read the documentation:
Quote: | Originally Posted by 4.2.1 Regular Expression Syntax
Matches if the current position in the string is preceded by a match for ... that ends at the current position. This is called a positive lookbehind assertion. (?<=abc)def will find a match in "abcdef", since the lookbehind will back up 3 characters and check if the contained pattern matches. The contained pattern must only match strings of some fixed length, meaning that abc or a|b are allowed, but a* and a{3,4} are not. Note that patterns which start with positive lookbehind assertions will never match at the beginning of the string being searched; you will most likely want to use the search() function rather than the match() function:
|
Look-behind requires fixed-width pattern, your pattern contains the variable-width .* in the look behind. You need to write something like "Hello.*:(.*)" and extract the first group. (Or better, use split() on the colon)
__________________
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);
|