Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: line by line match on an array of strings

by holli (Monsignor)
on Jan 09, 2008 at 11:29 UTC ( #661317=note: print w/replies, xml ) Need Help??

in reply to line by line match on an array of strings

You could try to feed your strings into Regexp::Assemble. That way you get a single regex you can use to test your lines against, which would probably speed things up. OTOH, you cannot tell wich of your original search strings actually matched the line, if that is important for you. If it is, then you would have to do your explicit tests after the regex matched. Depending on the blank/hit ratio it may still be faster.

Update: as per bibliophile's comment below.

holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: line by line match on an array of strings
by bibliophile (Parson) on Jan 09, 2008 at 14:52 UTC
    Interesting. I'd never heard of Regexp::Assemble...
    From the doc:
    It is also possible to track the original patterns,
    so that you can determine which, among the source patterns
    that form the assembled pattern, was the one that caused
    the match to occur.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://661317]
[Cosmic37]: hey erix are you there? earlier you said that one should check whether neural networks actually work... did you have a bad experience with neuralnetworks?

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-02-20 19:46 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (274 votes). Check out past polls.