Skip to main content

Crate aho_corasick

Crate aho_corasick 

Source
Expand description

Aho-Corasick multi-pattern string matching automaton.

Constructs a trie over the given pattern set, then adds failure links (BFS) to enable O(n + m + z) searching where n is the text length, m is the total pattern length, and z is the number of matches.

§Examples

use aho_corasick::{AhoCorasick, Match};

let ac = AhoCorasick::new(&["he", "she", "his", "hers"]);
let matches = ac.find_all(b"ahishers");
assert_eq!(matches.len(), 4);

Structs§

AhoCorasick
Aho-Corasick automaton for multi-pattern searching.
Match
A pattern occurrence found in the text.