in reply to Pimp My RegEx
You would use the substr expression above to access what you're currently capturing, though you don't indicate that what you're capturing is actually used at all. .my $parse_log_entry = qr/^$dateRegex/ms; ... my $prevpos = 0; while( $logfile =~ m/$parse_log_entry/g ) { $count++; # count number of parsed strings if ($prevpos) { # print "Do something with $prevpos .. $-[0]\n"; # print substr($logfile, $prevpos, $-[0]-$prevpos), "\n"; } $prevpos = $-[0]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pimp My RegEx
by heathen (Acolyte) on May 31, 2005 at 20:30 UTC | |
by Roy Johnson (Monsignor) on May 31, 2005 at 20:35 UTC |