Lookahead
What this is
Lookahead asserts what follows without consuming it. (?=\d) is 'next is a digit'. (?!\d) is the opposite. Password rules (one upper, one digit) are the usual demo — and often better as separate tests.
FAQ
- Can I capture inside lookahead?
- Yes, but the match length stays zero. Groups still populate.