Regular Expression Linking Examples

Matching a specific string:

Use the /pattern/ syntax to match a specific string:

See example

Matching any of multiple strings:

Use the /pattern|pattern/ syntax to match any of multiple strings:

See example

Matching a range of strings:

Use the /^pattern1-pattern2/ syntax to match any string between pattern1 and pattern2

See example

Matching a specific character:

Use the /pattern/ syntax to match a specific character:

See example

Matching a word:

Use the \bword\b syntax to match a word:

See example

Matching a word boundary:

Use the \b syntax to match a word boundary:

See example

Matching a digit:

Use the \d syntax to match a digit:

See example

Matching a non-digit:

Use the \D syntax to match a non-digit:

See example

Matching a whitespace character:

Use the \s syntax to match a whitespace character:

See example

Matching a non-whitespace character:

Use the \S syntax to match a non-whitespace character:

See example

Matching a word character class:

Use the \w syntax to match any word character (alphanumeric plus underscore):

See example

Matching a non-word character class:

Use the \W syntax to match any non-word character:

See example

Matching a word boundary:

Use the \b syntax to match a word boundary:

See example

Matching a start of a line:

Use the ^ syntax to match the start of a line:

See example

Matching an end of a line:

Use the $ syntax to match the end of a line:

See example

Matching a newline:

Use the \n syntax to match a newline:

See example

Matching a tab:

Use the \t syntax to match a tab:

See example

Matching a carriage return:

Use the \r syntax to match a carriage return:

See example

Matching a form feed:

Use the \f syntax to match a form feed:

See example

Matching a vertical tab:

Use the \v syntax to match a vertical tab:

See example