U.S. flag

An official website of the United States government

Dot gov

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Https

Secure .gov websites use HTTPS
A lock () or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Searching with regular expressions

Searching with regular expressions is an advanced technique that looks for specific patterns, as opposed to certain terms and phrases. With regular expressions, you can use pattern matching to search for particular strings of characters rather than constructing multiple, literal search queries.

You can use regular expressions to search for URLs, email addresses, and other strings that follow a specific pattern.

Examples

(assessment|performance) Displays all sections containing the words assessment OR performance
[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4} Displays email addresses with common domains (.gov, .com, .edu)

Pattern List

Pattern What the pattern matches
* Zero or more instances of string preceding it
+ One or more instances of strings preceding it
. Any single character
? Match zero or one instances of the strings preceding it.
^ caret(^) matches Beginning of string
$ End of string
[abc] Any character listed between the square brackets
[^abc] Any character not listed between the square brackets
[A-Z] Match any upper case letter.
[a-z] Match any lower case letter
[0-9] Match any digit from 0 through to 9.
[class] Matches a character class i.e. [:alpha:] to match letters, [:space:] to match white space, [:punct:] is match punctuations and [:upper:] for upper class letters.
{n} n instances of preceding element
{m,n} m through n instances of preceding element