Modern regexes support named capture groups (`(?<name>pattern)`) and lookaround assertions (`(?<=...)`, `(?=...)`) for parsing text cleanly.
js const match = "0xAbC...".match(/^0x(?<hex>[a-fA-F0-9]+)$/); console.log(match?.groups?.hex);
100 XP to Apprentice
Assertions, lookaheads, and named capture groups.
AI translates the explanation and quiz text while preserving code and answer scoring.
Modern regexes support named capture groups (`(?<name>pattern)`) and lookaround assertions (`(?<=...)`, `(?=...)`) for parsing text cleanly.
js const match = "0xAbC...".match(/^0x(?<hex>[a-fA-F0-9]+)$/); console.log(match?.groups?.hex);
1. How do you define a named capture group in JavaScript regex?
2. What does a positive lookahead (?=...) do?
3. Why is the global regex flag /g with RegExp.test() risky in loops?