Applies to:
Regex

Issue:

There can be scenarios where the regex you test in any online site (example: https:..regex101.com) may give error and the same gets processed without any issue in Ephesoft internal regex builder or vice versa.

For Example below regex in online sites gives pattern error and claims the quantifier ? (A quantifier inside a lookbehind makes it non-fixed width)

(?i)(?<!last\s?)inv(oice)?\s?(number|nr|no\.?)|doc(?!ument\s?date|umentation)|document(?!\s?date|ation)

 

Root Cause & Solution:

Different online regex platforms use different regex engines which may or may not process the regex depending upon its syntax check. A regex should always be selected by testing it on any java based online platform and then by testing the regex expression in Ephesoft as well to make sure that regex is valid.

In above case The pattern gives you an error because of the regex engine itself. Some of the regex engines use strict language expression. The regex expression mentioned above  works without any issues in a javascript based regex engine.

Reference article:
https://stackoverflow.com/questions/9030305/regular-expression-lookbehind-doesnt-work-with-quantifiers-or/11681936