BuildUtilities

What is a regular expression (regex)?

A mini-language for describing patterns in text, used to find, validate, or replace strings.

A regex looks like `/^[a-z]+@[a-z]+\.[a-z]+$/` and reads as 'one or more lowercase letters, then @, then more letters, then a dot, then more letters'.

Every modern language and editor supports them. The syntax is mostly shared, with small dialect differences (JavaScript, PCRE, .NET, POSIX).

Reach for regex when text follows a clear pattern. Don't use it for HTML (use a parser) or anything recursive (use a real grammar).

Match a basic email

^\S+@\S+\.\S+$

Related tools

Keep reading

Tip Jar