Registry / utility / aho-corasick

aho-corasick

JSON →
library1.1.4rscratesunverified

Fast multiple substring searching using the Aho-Corasick algorithm.

# Cargo.toml [dependencies] aho-corasick = "1.1.4"
INSTALL
IMPORT
SIG · AHO-CORASICK
A
aho-corasick
utilityrustv1.1.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AhoCorasick
use aho_corasick::AhoCorasick;

Searches for multiple patterns in a string and collects all matches.

use aho_corasick::AhoCorasick; let patterns = &["hello", "world", "foo"]; let ac = AhoCorasick::new(patterns).unwrap(); let haystack = "hello world"; let matches: Vec<_> = ac.find_iter(haystack).collect(); println!("Found matches: {:?}", matches);
Debug
Known issues
gotchaAhoCorasick::new can panic if patterns are empty or contain invalid UTF-8; use try_from for fallible construction.
fix
Use AhoCorasick::try_from(patterns) or handle the Result from new() properly.
affects: >=1.0.0
Upgrade
Version history
1.1.4latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
26
Meta
1
OpenAI (training)
1
Resources
aho-corasick — cargo add aho-corasick · libregistry