Please contact the project administrators of this project at the project summary page.
This is the cl-string-match project ("clstringmatch")
Common Lisp provides a SEARCH function to lookup given keys in a string, but its implementation can be subotimal: it can be beaten in some cases by even the simpliest brute-force algorithm. This project is aimed at implementing robust substring search (subsequence search) algorithms for Common Lisp.
Along with subsequence search (matching) algorithms this package provides implementations of the following data structures and utility algorithms:
Check also the API reference.
At the moment Cl-String-Match is not supported by Quicklisp. Installation is manual.
Cl-String-Match exports functions in
cl-string-match package (nicknamed
Shortcuts look for given pattern
txt. They are usually much slower
but are easier to use:
string-contains-brute pat txtBrute-force
string-contains-bm pat txtBoyer-Moore
string-contains-rk pat txtRabin-Karp
string-contains-kmp pat txtKnuth-Morris-Pratt
string-contains-ac pat txtAho-Corasick
A more robust approach is to use pre-calculated index data
that is processed by a pair of
search-bm bm txt
search-rk rk txt
search-kmp kmp txt
search-ac ac txt. Here
initialize-accan accept a list of patterns that are compiled into a trie.
Following example looks for a given
pat in a given line of
txt using Rabin-Karp algorithm
(let ((idx (initialize-rk pat))) (search-rk idx txt))
This project is still a work in progress. Any contributions are welcome!