Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Why this code not working with pcap files?

by graff (Chancellor)
on Nov 03, 2012 at 04:23 UTC ( #1002072=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002072]
[stevieb]: Damn... just wasted two hours wondering why num 23 wasn't setting bit 5 in a register. I was working on the decimal, but the register holds BCD numbers. Sigh.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2018-05-22 16:35 GMT
Find Nodes?
    Voting Booth?