JavaScript Regex Characters — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the JavaScript Regex Characters lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Match any digit
easy10 minReport whether the text contains a digit.
- 2
Use your own set
easy10 minReport whether the word contains a vowel.
- 3
Use a range
easy10 minReport whether the text contains a capital letter.
- 4
Exclude a set
easy10 minReport whether the code contains anything that is not a digit.
- 5
Escape a real dot
medium10 minMatch a literal dot in the file name.
Find the bug(5)
- 1
Fix the unescaped dot
easy8 minAn unescaped dot matches any character at all.
- 2
Fix the wrong class
easy8 minThe letter class does not match digits.
- 3
Fix the caret placed outside
easy8 minA caret inside the brackets is what inverts the set.
- 4
Fix the range written backwards
easy8 minA range must go from the lower character to the higher one.
- 5
Fix the whitespace class
easy8 minA literal space misses tabs and newlines.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace