UNDER DEVELOPMENT
This crate provides a fast implementation of the Aho-Corasick algorithm. Its intended use case is for fast substring matching, particularly when matching multiple substrings in a search text. This is achieved by compiling the substrings into a finite state machine.
This implementation provides optimal algorithmic time complexity. Construction
of the finite state machine is O(p)
where p
is the length of the substrings
concatenated. Matching against search text is O(n + p + m)
, where n
is
the length of the search text and m
is the number of matches.
Dual-licensed under MIT or the UNLICENSE.
http://burntsushi.net/rustdoc/aho-corasick/.
Aho-Corasick is useful for matching multiple substrings against many long
strings. If your long string is fixed, then you might consider building a
suffix array
of the search text (which takes O(n)
time). Matches can then be found in
O(plogn)
time.