Question 1 of 16
JavaScript Regular Expressions Quiz
Check your understanding of ECMAScript regular-expression syntax, flags, captures, match indices, Unicode modes, and state.
Knowledge check
JavaScript Regular Expressions Quiz
Check your understanding of ECMAScript regular-expression syntax, flags, captures, match indices, Unicode modes, and state.
- Stuck? Each question has an optional hint.
- Skip a hard question and review it before your results.
- Questions and answer options can shuffle between attempts.
You can retake this quiz whenever you like.
Question 2 of 16
Which pattern matches one ASCII digit?
Question 3 of 16
What does `+` mean?
Question 4 of 16
Which pattern matches exactly `cat` as the whole input?
Question 5 of 16
What is match[0] after a successful `exec()`?
Question 6 of 16
Where are named captures exposed?
Question 7 of 16
Why group `cat|dog` when applying `^` and `$` to both alternatives?
Question 8 of 16
Which flag lets `.` match line terminators?
Question 9 of 16
Which String method returns the first matching index?
Question 10 of 16
What does `matchAll()` provide?
Question 11 of 16
What does positive lookahead do?
Question 12 of 16
Which flag enables Unicode-aware RegExp pattern semantics?
Question 13 of 16
What does `\p{Letter}` represent in Unicode mode?
Question 14 of 16
Which flag enables Unicode sets mode?
Question 15 of 16
Why can `/\d/g` be stateful when reused?
Question 16 of 16
What does the `d` flag add to a successful RegExp match?
Quiz results
Review
-
What does `/cat/` search for?Hint used
-
Which pattern matches one ASCII digit?Hint used
-
What does `+` mean?Hint used
-
Which pattern matches exactly `cat` as the whole input?Hint used
-
What is match[0] after a successful `exec()`?Hint used
-
Where are named captures exposed?Hint used
-
Why group `cat|dog` when applying `^` and `$` to both alternatives?Hint used
-
Which flag lets `.` match line terminators?Hint used
-
Which String method returns the first matching index?Hint used
-
What does `matchAll()` provide?Hint used
-
What does positive lookahead do?Hint used
-
Which flag enables Unicode-aware RegExp pattern semantics?Hint used
-
What does `\p{Letter}` represent in Unicode mode?Hint used
-
Which flag enables Unicode sets mode?Hint used
-
Why can `/\d/g` be stateful when reused?Hint used
-
What does the `d` flag add to a successful RegExp match?Hint used