I'm trying to replace the following string with offset of 2 characters from beginning and end.
Example input: A9999999999
Expected output: A9********99
I have tried the following but not able to narrow down to exact format
regexp_replace(a, '[0-9]', '*') as a
REGEXP_REPLACE(a, '[0-9]', '*', 6) as a
REGEXP_REPLACE(a, '\1((.*)\4$)', '\1*******\3') as a
REGEXP_REPLACE('A9999999999', '(.{2}).*(.{2})', '\1*******\2')
based on you examples, it looks like your string will always be the same length.
I select the first and last characters in capture groups and use those in the final string