The question is about lookahead and lookbehind assertion.
Reference to lookahead:
(?=...)
Matches if ... matches next, but doesn’t consume any of the string. This is called a lookahead assertion. For example, Isaac (?=Asimov) will match 'Isaac ' only if it’s followed by 'Asimov'.
Match Issac and look its behind, but called "lookahead".
While:
(?<=...)
Matches if the current position in the string is preceded by a match for ... that ends at the current position. This is called a positive lookbehind assertion. (?<=abc)def will find a match in 'abcdef', since the lookbehind will back up 3 characters and check if the contained pattern matches.
Match def
and check its head for abc
but called "lookbehind".
I am very confused about the unintuitive name of lookbehind and lookahead. Where do the names originate?