I remember some time back when I was trying to use regex in EE 3 it broke the software because it did not accept the | in the regex expression. This is actually a bug in CodeIgniter which made it impossible for me to use the build in regex validation and I had to use external libraries But as far as I know Expression Engine moved away from CodeIgniter.
This is actually posted here as well:
Is someone aware if this was ever fixed in Expression Engine? Because it was almost impossible to use any sort of regex because of the bug.
I don’t see any records of this being fixed or updated in EE. I’ve updated the link on StackOverflow though and you can find it here https://expressionengine.com/forums/archive/topic/220094/form-validation-regex_match. Let me know if that helps or I can get someone with more knowledge to dig in deeper.