Skip to main content

Lookahead and Lookbehind Assertions

Positive Lookahead (?=...)

0:00
LearnStep 1/3

Understanding Lookahead

Positive Lookahead: Peeking Ahead

Lookaheads are zero-width assertions. They peek forward, check for a match, and then return to the position where they started. The syntax is (?=...).

python

Notice that the match is only "Windows", not "Windows 11". The lookahead checks but doesn't consume.