Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Suggestion for regular expression speed improvement.

by moritz (Cardinal)
on Jun 15, 2009 at 12:37 UTC ( [id://771639]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Suggestion for regular expression speed improvement.
in thread Suggestion for regular expression speed improvement.

No, don't. Go with the tips Corion gave you above, it's much more sensible to use split or a module - my explanation was mostly to satisfy academic curiosity, and not meant as a suggestion on how to solve your problem.
  • Comment on Re^3: Suggestion for regular expression speed improvement.

Replies are listed 'Best First'.
Re^4: Suggestion for regular expression speed improvement.
by bala.linux (Novice) on Jun 15, 2009 at 13:03 UTC
    As I mentioned above, I would not be able to take that approach. Since, I want to enable support to match log lines of any format with grouping. If I go by CSV, then I would not be able to parse other formatted logs like syslogs and other proprietary logs.

      You need to think out of the box. Make your system handle the various cases. A regex, a split, an unpack, maybe even an xml parser....

      Definitely doing it the way you are is wrong. If you are really insistent on ignoring our advice (unwise really), then at least use inversion and you might want to investigate the (?>...) construct "atomic matching". As well as adding anchors to your pattern.

      ---
      $world=~s/war/peace/g

        Make your system handle the various cases. A regex, a split, an unpack, maybe even an xml parser....

        I agree. The simplest solution is to make the caller supply a code reference, which you then call and which does the parsing/matching/unpacking/whatever.

        Exactly. This was my approach but before taking that up I wanted to check with the community whether Im doing anything wrong with regular expression. May be I expected too much from the regular expression. Anyway, thanks for your inputs :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://771639]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found