# Using trigrams against typos

DevFeed: [Using trigrams against typos](<https://devfeed.tech/articles/using-trigrams-against-typos-34520.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2013/09/using-trigrams-against-typos/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2013-09-06T14:15:00Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Extension](<https://devfeed.tech/topics/extension.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [auto-completion](<https://devfeed.tech/tags/auto-completion.md>), [extension](<https://devfeed.tech/tags/extension.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [regular-expressions](<https://devfeed.tech/tags/regular-expressions.md>), [search](<https://devfeed.tech/tags/search.md>)

## AI overview

This tutorial explains how PostgreSQL's pg_trgm extension can support approximate string matching, typo-correction suggestions, autocomplete, and searches involving POSIX regular expressions. It contrasts trigram-based matching with PostgreSQL full-text search and introduces a product-catalog example.

## Source excerpt

In our ongoing Tour of Extensions we played with earth distance in How far is the nearest pub? then with hstore in a series about trigger, first to generalize Trigger Parameters then to enable us to Auditing Changes with Hstore. Today we are going to work with pg_trgm which is the trigrams PostgreSQL extension: its usage got seriously enhanced in recent PostgreSQL releases and it's now a poor's man Full Text Search engine.