Question

What are the best string matching algorithms which can be used to search multiple patterns within a string?

Was it helpful?

Solution

For looking for exact match to a number of different strings I favour the Aho-Corasick string matching algorithm, but there are a number of possible contenders, depending on what your patterns are. One starting point to see what is around in practical use would be look at the different variants of grep mentioned on Wikipedia or pointed to from there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top