Regular expression
A compact notation for describing a pattern of characters, used to find, check, or extract text: five digits in a row, or anything that looks like an email address.
A pattern checks the shape of a value, not whether it is true. A string can look exactly like a phone number and belong to nobody. Often shortened to regex.
Where it comes up
- Phone number formatsThe same phone number is written with different punctuation, spacing, prefixes, and extensions.
- Email typos and letter caseEmail addresses differ by capitalization, or contain small typing errors that make them undeliverable.
See also
- ParsingReading text and working out its structure: turning the characters 03/04/2025 into a date, or one line of a file into separate fields.
- ValidationChecking values against rules, such as a date being in the past or a state code being on the allowed list, and reporting what fails.
- StringA value stored as a sequence of characters, which is to say text. The characters 2025 held as a string are four symbols, not a number.