9

Searching Using Regular Expressions

In this chapter, you’ll learn how to use regular expressions within MySQL WHERE clauses for greater control over data filtering.

Understanding Regular Expressions

The filtering examples in the previous two chapters enabled you to locate data using matches, comparisons, and wildcard operators. For basic filtering (and even some not-so-basic filtering), this might be enough. But as the complexity of filtering conditions grows, so does the complexity of the WHERE clauses themselves—and this is where regular expressions become useful.

A regular expression is a special string (that is, a set of characters) that is used to match text. If you need to extract phone numbers from a text file, for example, you might ...

Get MySQL Crash Course, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.