HomePhabricator

Split word detection in multiple preg_match calls

Authored by dcausse on Oct 25 2019, 3:03 PM.

Description

Split word detection in multiple preg_match calls

trying to scan a word query definition in one go caused pcre
to fail with PREG_JIT_STACKLIMIT_ERROR.
Instead of trying to optimize the regex simply split in two steps:

  • negation detection
  • escape sequence, in word negations and end of word query detection

This moves the complexity to the caller instead of pcre which used the
stack to solve the regex.
Here we simply loop.

Bug: T236419
Change-Id: Ib7701ae8fefbb6ce3fb43ac1ee8faa486e79b2ae