consolidate regexes
Jérôme Étévé
jerome.eteve at gmail.com
Tue Feb 25 14:42:55 GMT 2014
If you're looking to find the matches of a large number of strings in
a body of text, there's also https://metacpan.org/pod/Text::Scan .
AFAIK, it's very fast, as it's a C implementation of
http://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_string_matching_algorithm
It doesn't do regexes though, just plain text matching.
J.
On 25 February 2014 14:21, Alex Balhatchet <kaoru at slackwise.net> wrote:
> Hey Dirk,
>
> The search time you're after is Trie.
>
> http://en.wikipedia.org/wiki/Trie
>
> https://metacpan.org/search?q=trie
>
> The POD of Dan Kogai's Regexp::Trie lists some alternatives and the
> description compares them a little.
>
> https://metacpan.org/pod/Regexp::Trie#DESCRIPTION
>
> https://metacpan.org/pod/Regexp::Trie#SEE-ALSO
>
> Hope that helps,
>
> - Alex
>
> On 25 February 2014 12:49, Dirk Koopman <djk at tobit.co.uk> wrote:
>> I am looking at an application where some incoming string needs to be
>> compared to many (certainly 10s, probably 100s but not 1000s) regexes. This
>> being a message passing application, speed is more important than it might
>> otherwise be. The list of regexes is single exit simple ladder logic (i.e.
>> the first match exits the list and is dealt with by the associated
>> function).
>>
>> I am wondering whether there is some regex consolidation possible that turns
>> the regex list into some single mega regex or a more formal state machine
>> driven thingy.
>>
>> Dirk
>>
>>
--
Jerome Eteve
+44(0)7738864546
http://www.eteve.net/
More information about the london.pm
mailing list