Script Valley
Regex: Actually Useful Patterns
Regex Fundamentals/Assessment

Practice & Assessment

Test your understanding of Regex Fundamentals

Multiple Choice Questions

5
1

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

1
1

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

Easy

Mini Project

1

Input Sanitizer Micro-Library

Build a JavaScript module with four exported functions using only the regex concepts from this module.

Easy
Practice & Assessment โ€” Regex Fundamentals โ€” Regex: Actually Useful Patterns โ€” Script Valley โ€” Script Valley