Check the thread at Digit \d matching in regex
The regex matching uses OS libraries and varies by system. Safest to use only POSIX-compliant expressions. Good links in that thread, but basically \d should instead be [[:digit:]]
and \w should instead use [[:word:]]