Introduction to Regular Expressions (JavaScript)

These topics introduce the concept of regular expressions and explain how to create and use them.

A regular expression describes one or more strings to match when you search a body of text. The expression serves as character pattern to compare with the text being searched. You can use regular expressions to search for patterns in a string, replace text, and extract substrings.

Uses for Regular Expressions

Illustrates circumstances that would benefit from the use of regular expressions.

Creating a Regular Expression

Explains how to construct a regular expression.

Regular Expression Programming

Provides code examples that show how to search for patterns in a string, replace text, and extract substrings.

Regular Expression Syntax

Summarizes the elements that make up the regular expression syntax and provides examples.

Lists of Matching Characters

Describes how to match a single character from a list of characters or range of characters.


Explains how to search for a character or set of characters that is repeated a specific number of times.


Explains how to specify that a pattern that you are searching for has to appear either at the start or end of the searched string, or the start or end of a line or word in the searched string.

Alternation and Subexpressions

Explains how to specify a choice between two or more alternatives in a regular expression. Also explains how to create a subexpression.


Explains how to refer to a subexpression from within a regular expression, and from within a replacement string.

JavaScript User's Guide

Provides information about how to use JavaScript and includes a guide to regular expressions.

Community Additions