RegExp (Standard - JavaScript)

Represents a regular expression.

Defined in

Standard (JavaScript)

Usage

A regular expression describes search criteria. Here are some sample expressions to give you the idea:
Expression Meaning
(Moscow) Matches Moscow.
(Moscow)|(Tokyo) Matches Moscow or Tokyo.
\s*;\s* Matches zero or more spaces followed by a semicolon followed by zero or more spaces.
\s*;\s+ Matches zero or more spaces followed by a semicolon followed by one or more spaces.
\w+ Matches one or more alphanumeric characters.

Search the Web for "regular expression" to find comprehensive information.

Form a literal regular expression by delimiting the expression with forward slashes, optionally followed by one or both of the following: g for global and i for case insensitive. Here are examples:
  • All matches of Moscow.
    /(Moscow)/g
  • All matches of moscow case insensitive.
    /(moscow)/gi
  • First match of moscow case insensitive.
    /(moscow)/i