Shawn Wagner <shawnw.mobile@gmail.com>
Provides a variety of string search algorithms written in Typed Racket. They look for sequences of exact code points or bytes, not equivalencies. When using with non-ASCII text, consider normalizing strings first.
Functions for searching for a single substring in strings.
Search for strings using the Knuth-Morris-Pratt algorithm. These functions are also available in the string-searchers/kmp module, without the kmp- prefix.
procedure
[ #:case-insensitivecase-insensitive?])→kmp-matcherpattern:String
procedure
( kmp-matcher? obj)→Boolean
obj:Any
procedure
( kmp-matcher-ci? m)→Boolean
m:kmp-matcher
procedure
m:kmp-matcher
procedure
( kmp-find-string mtext[startend])→(Option Index )
m:kmp-matchertext:String
procedure
text[ startendm:kmp-matchertext:String
Search for strings using the Boyer-Moore-Horspool algorithm. These functions are also available in the string-searchers/bmh module, without the bmh- prefix.
procedure
[ #:case-insensitivecase-insensitive?])→bmh-matcherpattern:String
procedure
( bmh-matcher? obj)→Boolean
obj:Any
procedure
( bmh-matcher-ci? m)→Boolean
m:bmh-matcher
procedure
m:bmh-matcher
procedure
( bmh-find-string mtext[startend])→(Option Index )
m:bmh-matchertext:String
procedure
text[ startendm:bmh-matchertext:String
Note: There are no case-insensitive routines for byte strings.
procedure
( bmh-make-byte-matcher pattern)→bmh-byte-matcher
pattern:Bytes
procedure
( bmh-byte-matcher? obj)→Boolean
obj:Any
procedure
m:bmh-byte-matcher
procedure
( bmh-find-byte-string mtext[startend])→(Option Index )
m:bmh-byte-matchertext:Bytes
procedure
text[ startendm:bmh-byte-matchertext:Bytes
Sections for searching for any of multiple different substrings in a string.
Search for strings using the Aho-Corasick algorithm. These functions are also available in the string-searchers/ahoc module, without the ahoc- prefix.
procedure
( ahoc-make-matcher s...)→ahoc-matcher
s:String
procedure
( list->ahoc-matcher strings)→ahoc-matcher
procedure
( ahoc-matcher? obj)→Boolean
obj:Any
procedure
( ahoc-matcher-patterns m)→(Listof String )
m:ahoc-matcher