I ran into this a while back and have a long thread on it here that I can try to find later. Basically it’s due to differences in the underlying regex libraries provides by the OS. The safest methods are to use only POSIX-compliant regular expressions rather than something like Perl-compatible regex. This gets ugly, but is doable.
Rather than expressions like “\w” for word and “\s” for whitespace, you have to use “[[:word:]]” and “[[:space:]]” if I recall correctly.
Edit: fixed expression and here’s the discussion Digit \d matching in regex