Regex: Actually Useful Patterns
Regex Fundamentals/Assessment
Practice & Assessment
Test your understanding of Regex Fundamentals
Multiple Choice Questions
51
What does /^\d{5}$/ match?
2
Which regex correctly matches both 'color' and 'colour'?
3
What does the 'g' flag do in JavaScript regex?
4
What is the difference between \d and \w?
5
Why does /\bcat\b/.test('concatenate') return false?
Coding Challenges
11
EasyUS ZIP Code Validator
Write a function validateZip(str) that returns true if str is a valid US ZIP code: either 5 digits (e.g. '90210') or ZIP+4 format (e.g. '90210-1234'). Return false for anything else.
Mini Project
1
EasyInput Sanitizer Micro-Library
Build a JavaScript module with four exported functions using only the regex concepts from this module.
