SQL REPLACE with Multiple [0-9]

I have a string that I want to replace a group of numbers.
The string contains groupings of numbers (and a few letters). ‘A12 456 1 65 7944’ I want to replace the group of 3 numbers with ‘xxx’, and the group of 4 numbers with ‘zzzz’

I thought something like REPLACE(@str, '%[0-9][0-9][0-9]%', 'xxx') would work, but it doesn’t. I can’t even get '%[0-9]%' to replace anything.

If REPLACE is not suitable, how can I replace groups of numbers?

Author: Steffy Alen