Path: blob/main/files/en-us/web/javascript/guide/regular_expressions/quantifiers/index.md
6552 views
------{{jsSidebar("JavaScript Guide")}}
Quantifiers indicate numbers of characters or expressions to match.
{{EmbedInteractiveExample("pages/js/regexp-quantifiers.html", "taller")}}
Types
Note: In the following, item refers not only to singular characters, but also includes character classes, Unicode property escapes, groups and backreferences.
| Characters | Meaning |
|---|---|
x*
|
Matches the preceding item "x" 0 or more times. For example,
|
x+
|
Matches the preceding item "x" 1 or more times. Equivalent to
|
x?
|
Matches the preceding item "x" 0 or 1 times. For example,
If used immediately after any of the quantifiers |
x{n}
|
Where "n" is a positive integer, matches exactly "n" occurrences of
the preceding item "x". For example, |
x{n,}
|
Where "n" is a positive integer, matches at least "n" occurrences of
the preceding item "x". For example, |
x{n,m}
|
Where "n" is 0 or a positive integer, "m" is a positive integer, and
|
|
|
By default quantifiers like
|