Full-Text Search

Learn about methods to search full-text beyond pattern matching in MySQL.

MySQL provides capabilities for matching regular expressions against some text. For example, using REGEXP_LIKE(), we can match the regular expression (ex|in)terior against the names of car parts as in our running example:

Press + to interact
-- Retrieve all exterior and interior car parts.
SELECT *
FROM CarPart
WHERE REGEXP_LIKE(name, '(ex|in)terior');

However, pattern matching only unfolds its full potential if applied to longer texts. One of the functions provided by MySQL, REGEXP_SUBSTR(), is particularly useful in this case. The function returns the nthn^{th} match of a regular expression in the specified text. While this concept is powerful, it is limited by the strictness of the regular expression syntax. That is, we cannot perform actual fuzzy ...

Access this course and 1400+ top-rated courses and projects.