http://www.perlmonks.org?node_id=1002072


in reply to Why this code not working with pcap files?

Following up on the first two replies, if the code seems to work well enough on a small set if input data, then the problem is probably with the regexes being to complicated. For one thing, you're capturing up to 8 strings with parens, but you never use more than three of the captures. But the real problem is the number of greedy matches (+ or * instead of using specific numbers or ranges or non-greedy +? and *? wherever possible).

It also looks like you might not understand some basic details about regex syntax. When you say ([0-9]+.[0-9]+) are you forgetting that "." matches any character (not just a literal period)? Your use of vertical bars in ([F|.|R]) probably doesn't mean exactly what you intend.

There's bound to be an easier way to parse each line; maybe start by splitting on whitespace into an array, then test the particular elements of the array that matter (ignore the rest), rather than running one or more heavy regexes on the full content of each line.

It might help if you post a small amount of relevant sample data.