Regexp capture group list

Uri Guttman uri at StemSystems.com
Tue Nov 10 17:46:32 GMT 2009


>>>>> "PLE" == Paul LeoNerd Evans <leonerd at leonerd.org.uk> writes:

  PLE>   substr( $_[0], 0, $+[0] ) = "";

4 arg substr is faster than lvalue substr.

	substr( $_[0], 0, $+[0], '' ) ;

i do a very similar recursive parse in Template::Simple and i also use
$1 and $2 in s/// in the basic rendering. the compiler variation does
m// and then a 4 arg substr to chop off the matched leading text. you
can see the basic code on cpan and the latest unreleased version with
the compiler code at:

	http://perlhunter.com/git/template
	http://perlhunter.com/git/gitweb/gitweb.cgi

there also may be a way to use \G in the regex to start parsing from
where you last parsed. i couldn't get that to work but maybe ask damian
for help. :)

uri

-- 
Uri Guttman  ------  uri at stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


More information about the london.pm mailing list