Your test data has invisible Unicode characters.
Delete them and your regex will work just fine .
For example, your example (-112|-522) is actually \u0028\u002d\u0031\u0031\u0032\u007c\u202d\u202d\u002d\u0035\u0032\u0032\u202c\u202c\u0029 .
You have several U+202D (LEFT-TO-RIGHT OVERRIDE) and U+202C (POP DIRECTIONAL FORMATTING).
If you want to allow them in your regular expression, you can include them:
\(\p{Cf}*(-?\p{Cf}*\d+)\p{Cf}*\|\p{Cf}*(-?\p{Cf}*\d+)\p{Cf}*\)
But the template gets pretty dirty. I just added a bunch of \p{Cf}* to allow these characters. Note that you still have to get rid of the characters between the minus sign and the numbers before you try to convert the captured substrings to integers.
It would probably be a lot easier to just replace anything that matches \p{Cf}+ with an empty string before continuing with your original template.
source share