loading...

JavaScript – Pattern Matching with Regular Expressions

A regular expression is an object that
describes a pattern of characters. The JavaScript RegExp class
represents regular expressions, and both String and RegExp define
methods that use regular expressions to perform powerful
pattern-matching and search-and-replace functions on text. JavaScript’s
regular expression grammar is a fairly complete subset of the
regular-expression syntax used by Perl 5, so if you are an experienced
Perl programmer, you already know how to describe patterns in
JavaScript.[17]

This chapter begins by defining the syntax that regular
expressions use to describe textual patterns. It then moves on to
describe the String and RegExp methods that use regular
expressions.


[17] Perl regular expression features that are not supported by
ECMAScript include the s
(single-line mode) and x
(extended syntax) flags; the \a,
\e, \l, \u,
\L, \U, \E,
\Q, \A, \Z,
\z, and \G escape sequences; the (?<= positive
look-behind anchor and the (?<! negative look-behind anchor; and
the (?# comment and the other
extended (? syntaxes.

Comments are closed.

loading...