Lookarounds provide you with an easy way of applying conditions to your expressions. Think if them as simple
if-statements: If that happened, match this.
if followed by / if not followed by
if [not] followed by
Sometimes, you may only want to match a certain condition if it is directly followed by a given other condition.
This can be done using lookahead. In SRL, a lookahead can be positive (
if followed by) or
if not followed by). The example below will only capture the number, if it's no more
followed by any other number.
capture (digit) if not followed by (anything once or more, digit)
SRL Query is matching!
SRL Query is not matching.
The SRL Query contains an error:
Whoops... you may have found a bug.
Generated Regular Expression:
if already had / if not already had
if [not] already had
Just like a lookahead, the lookbehind, which can be positive and negative as well, matches the characters exactly before that condition.
For example, you may only want to match
bar if it's directly following
capture "bar" if already had "foo"