http://qs321.pair.com?node_id=683957


in reply to Matching lines in 2+ GB logfiles.

The reason for the slow execution is most likely the use of the two .* in the regex which result in a very high number of checks inside the regex machine. This is difficult to explain as long you don't know what backtracking is and how it works.
For now just try this:
while ( $window =~ m/\w{3}\s{1,2}\d{1,2}([^\n]+)\n/oigc && $1 =~ /$re/ +) { &$callback($1); }

Precompiling $re using qr{} is recommended, or use the o option.

Replies are listed 'Best First'.
Re^2: Matching lines in 2+ GB logfiles.
by dbmathis (Scribe) on May 01, 2008 at 17:10 UTC

    I could not get this to work. Would not match anything.

    After all this is over, all that will really have mattered is how we treated each other.