Skip to content

NLP

Regex

  • regexper - Regular Expression Visualization Site.

Lookahead & lookbehind

Given the string foobarbarfoo

RegexDescription
bar(?=bar)finds the 1st bar ("bar" which has "bar" after it)
bar(?!bar)finds the 2nd bar ("bar" which does not have "bar" after it)
(?<=foo)barfinds the 1st bar ("bar" which has "foo" before it)
(?<!foo)barfinds the 2nd bar ("bar" which does not have "foo" before it)

Tools

Resources