Back to LanguageTool Homepage - Privacy - Imprint

Regex, negative lookbehind/lookahead etc

Is it possible to use negative lookbehind/lookahead expressions in regex expressions in Languagetool? For example if I only wanted to match the word “James” when it didn’t appear after Saint in regex, I would normally use something like the example below, but LT doesn’t seem to like it.

<regexp>(?<!Saint )James</regexp>

This is easy using tokens. Usually, rules are made using tokens, not regexp.

Hi @Maximum,

With tokens, it would look something like this:

<token>james<exception scope="previous">saint</exception></token>

Just in case you don’t know the page already: Detailed info is available here.

Thanks. Have managed to get it to work.

1 Like