Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. JavaScript
  3. Reference
  4. JavaScript error reference
  5. SyntaxError: incomplete quantifier in regular expression

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 validquantifier.

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

SyntaxError

What went wrong?

A{ character in a regular expression pattern starts aquantifier. A valid quantifier is in the form{n},{n,}, or{n,m}, wheren andm are non-negative integers andm is not less thann. If the{ character does not start a valid quantifier, aSyntaxError occurs.

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

Examples

Invalid cases

js
/1{/u;/1{a}/u;/1{}/u;/1{1,2,3}/u;/1{1, 2}/u;

Valid cases

js
/1{1}/u;/1{1,}/u;/1{1,2}/u;

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp