Can anyone please help? I want to replace SSN with dash for the given string using regexp_replace in Hive SQL
I am trying with below query but get the result as 1-2-3
select regexp_replace("123790634", '([0-9]{3})([0-9]{2})([0-9]{4})', '\\1-\\2-\\3');
My output should look like 123-79-0634
You can prefer using the dollar prefixed format instead
select regexp_replace('123790634', '(.{3})(.{2})(.{4})','$1-$2-$3')