The transform documentation listed here is outdated and is nonger actively maintained. Please refer to https://developer.sailpoint.com/idn/docs/transforms for IdentityNow Transform documentation.
Be aware regex parser is flawed, it can't parse valid regex expressions like:
000$
[0-9]{3}$
\\d{3}$
But it can parse
\\d{3}(?!\\d)
Looks like $ is the problem, I haven't tried to match something on the start with ^ but possible that is not also supported. No word about it in the documentation, learned this the hard way.
Maybe use the trim transform method to get rid of leading / trailing whitespace