Skip to content

Lookaround

Looking behind

The same idea pointed the other way, and the one place this engine says no.

(?<=…) asserts that what precedes the current position matches. (?<=\$)\d+ finds a number that follows a dollar sign, without the dollar sign being part of the match.

(?<!…) is the negative form, and at the start of the input it succeeds, because there is nothing behind to match.

This engine implements lookbehind only when its width is fixed — when every string it could match is the same length. It matches by stepping back that many characters and running the sub-pattern forwards.

The flavour itself allows a variable-length lookbehind, and matches it right to left. This engine refuses instead, with a written reason, because a wrong answer that looks right is worse than a refusal that explains itself.

Matcher

Every claim on the left has a pattern under it. Press one and it runs here, against the same engine that grades a task.