> For the complete documentation index, see [llms.txt](https://www.mlcompendium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.mlcompendium.com/natural-language-processing/string-matching.md).

# String Matching

## Tools

1. [**Fuzzy string matching library - fuzzywuzzy - using edit-distance**](https://towardsdatascience.com/natural-language-processing-for-fuzzy-string-matching-with-python-6632b7824c49)
2. [**Difflib**](https://docs.python.org/3/library/difflib.html)**,** [**difflib**](https://pymotw.com/2/difflib/)**-2**

![Susan Li, Fuzzy Wuzzy String Matching, medium.com](https://lh6.googleusercontent.com/y0wbP76ObQPtAtaM-hXk0uwO1-rtcRXfcB7wEZbbPCE05FexzLYfJZtXRO9GkNGcnAOfyxTuRQDRUszfFL5qz7waIBtYnDiJrceyFl_-8rs82yAZdmcoNVKtDU9EgPgHwT9bTy4z)

## **REGEX**

1. [**Why re is slow** ](https://swtch.com/~rsc/regexp/regexp1.html)
2. [**Benchmark**](https://github.com/mariomka/regex-benchmark)**,** [**comparisons**](https://rust-leipzig.github.io/regex/2017/03/28/comparison-of-regex-engines/)**,** [**more**](https://stackoverflow.com/questions/3544225/regular-expression-library-benchmarks)**,** [**many more**](https://stackoverflow.com/questions/11033190/regex-library-benchmark)**,**&#x20;
3. [**Split on separator but keep the separator**](http://programmaticallyspeaking.com/split-on-separator-but-keep-the-separator-in-python.html)**, in Python**
4. [**Semantic versioning**](https://regexr.com/39s32)
5. [**Hyperscan**](https://github.com/intel/hyperscan) **-** [**Hyperscan**](https://www.hyperscan.io/) [**(paper)**](https://www.usenix.org/system/files/nsdi19-wang-xiang.pdf) **is a high-performance multiple regex matching library. It follows the regular expression syntax of the commonly-used libpcre library, but is a standalone library with its own C API.**
6. [**Re2**](https://github.com/google/re2/tree/abseil/python) **-** [**python**](https://pypi.org/project/re2/) **This is the source code repository for RE2, a regular expression library.**

![](https://lh3.googleusercontent.com/-YwR-w4Xp3Z-FJH4yUu23QiFSBgr7EqkKGNhvG-c89kpsaHcEBeiqiUO4nEx-8VzEMIeaJosCR6JhDpWO5hqQjfwL2cSXUXapt_XUa_OdRmClhigiynQzDBy3zdrq_Bj4VYaWv2F)

1. [**Spacy’s Matcher & “regex”**](https://spacy.io/usage/rule-based-matching)
2. [**Flashtext**](https://github.com/vi3k6i5/flashtext)**- This module can be used to replace keywords in sentences or extract keywords from sentences. It is based on the** [**FlashText algorithm**](https://arxiv.org/abs/1711.00046)**.**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.mlcompendium.com/natural-language-processing/string-matching.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
