# fuzzystrmatch — Postgres extension

> Soundex, Metaphone and Levenshtein distance.

Source: https://scribase.com/extensions/fuzzystrmatch

Category: Text search and indexing. Version: 1.2. Optional, enabled per project.

## About

fuzzystrmatch compares strings by edit distance (levenshtein) or by how they sound (soundex, metaphone, dmetaphone). Useful for matching names that are spelled differently, deduplicating contacts, or suggesting "did you mean" corrections.

## Enable it

```sql
create extension if not exists fuzzystrmatch with schema extensions;
```

## Example

```sql
select levenshtein('kitten', 'sitting');        -- 3
select soundex('Robert'), soundex('Rupert');     -- R163, R163
select dmetaphone('Thompson'), dmetaphone('Tomson');

select name from customers where levenshtein(lower(name), lower('jon smith')) <= 2;
```

Upstream: https://www.postgresql.org/docs/17/fuzzystrmatch.html