C.W.K.
Stream
Quiz · 5 questions

👁️ Lookahead & Lookbehind

Match positions instead of characters — the zero-width family

Level 0Pattern-Curious
0 XP0/90 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

Quiz

01What does 'zero-width' mean in regex?
Hint
Position check, no character consumed.
02Pattern \d+(?=kg) against 5kg flour matches what?
Hint
The lookahead asserts but doesn't include the matched text.
03Why is Python's lookbehind restricted to fixed-width patterns?
Hint
The engine needs to know how far back to look.
04What does (?=.*[A-Z])(?=.*\d).{8,} require?
Hint
Multiple lookaheads at the same position = AND constraints.
05Which engines do NOT support lookaround at all?
Hint
Linear-time guarantee comes at a feature cost.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.