dgaramond2 has asked for the wisdom of the Perl Monks concerning the following question:
Suppose I have a lot of short strings (s1, s2, ... sn). I want to check, as fast as possible, whether any of them is in a long string (S). The short strings are not necessarily words, so I cannot use full-text indexing. Is there a smarter, more efficient way then doing:
S =~ /(s1|s2|...|sn)/Btw, it'd be nice if I can do case-insensitive match too.
The application is for blocking emails which might contain a list of keywords/strings which the user specifies in a blacklist.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fast searching of multiple substrings in a string
by Corion (Patriarch) on Oct 07, 2006 at 14:52 UTC | |
by betterworld (Curate) on Oct 07, 2006 at 17:56 UTC | |
|
Re: Fast searching of multiple substrings in a string
by jwkrahn (Abbot) on Oct 07, 2006 at 16:50 UTC | |
|
Re: Fast searching of multiple substrings in a string
by betterworld (Curate) on Oct 07, 2006 at 14:44 UTC |