user373215 user373215 - 1 year ago 83
C++ Question

API For KMP or Boyer-Moore string pattern matching in C++ / STL?

Wondering, if I want to replace strstr with a better string matching algorithm, like KMP or Boyer Moore, is there one in C++ or do we have to write on our own?

Wondering, what is the practical string matching function that everyone uses other than strstr?

This is with respect to C++/STL under Unix/Linux platform.

Answer Source

I haven't seen many that use features specific to C++, but there are quite a few implementations of KMP and (especially) variants of Boyer-Moore (e.g., Boyer-Moore-Horspool) around that are easily usable from C++.