A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Regex_incomplete_quantifier below:

SyntaxError: incomplete quantifier in regular expression - JavaScript

SyntaxError: incomplete quantifier in regular expression

The JavaScript exception "incomplete quantifier in regular expression" occurs when a regular expression pattern contains a {, but it does not start a valid quantifier.

Message
SyntaxError: Invalid regular expression: /1{/u: Incomplete quantifier (V8-based)
SyntaxError: incomplete quantifier in regular expression (Firefox)
SyntaxError: Invalid regular expression: incomplete {} quantifier for Unicode pattern (Safari)
Error type What went wrong?

A { character in a regular expression pattern starts a quantifier. A valid quantifier is in the form {n}, {n,}, or {n,m}, where n and m are non-negative integers and m is not less than n. If the { character does not start a valid quantifier, a SyntaxError occurs.

In Unicode-unaware mode, this syntax causes the { to become a literal character instead of generating an error, but this is a deprecated syntax and you should not rely on it.

Examples Invalid cases
/1{/u;
/1{a}/u;
/1{}/u;
/1{1,2,3}/u;
/1{1, 2}/u;
Valid cases
/1{1}/u;
/1{1,}/u;
/1{1,2}/u;
See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4