The _getCompoundedRegex in inc/parser/lexer.php that merges regexps from different sources into one is not correct in its escaping of parenthesis.
It is meant to escape the "(" and ")" that are not part of a (?x...) one.
However, it fails to do so in cases like:
which it turns into
(?:[^)]) -> (?:[^)]\)
(?:\)) -> (?:\)\)
[(] -> [\(]
I attach a patch that does the escaping using another approach.