Regex: Actually Useful Patterns
Lookaheads and Lookbehinds/Assessment
Practice & Assessment
Test your understanding of Lookaheads and Lookbehinds
Multiple Choice Questions
61
What does /foo(?=bar)/ match in the string 'foobar'?
2
What is the syntax for a negative lookbehind in JavaScript?
3
Which pattern extracts only the number after '$' in '$42 €10'?
4
What is catastrophic backtracking?
5
How do you assert that a position is NOT preceded by a digit?
6
In /^(?=.*\d)(?=.*[A-Z]).{8,}$/, what does (?=.*\d) do?
Coding Challenges
11
MediumCSS Value Extractor
Write a function extractValues(css) that takes a CSS string and returns an array of all numeric values that are NOT in px units.
Mini Project
1
MediumTemplate Variable Extractor
Build a function processTemplate(template, vars) that takes a template string and a vars object.
