-- yukaridaki linkte bulunan ornek sorgunun benim ornek taloda denenmesi SELECT regexp_replace(regexp_replace(address, '\D', '', 'g'), '(\d{3})(\d{3})(\d{4})', '(\1) \2-\3') address FROM public."PhoneFix_Cuno" ORDER BY id DESC LIMIT 100;
-- Benim istediğim format SELECT regexp_replace(regexp_replace(address, '\D', '', 'g'), '(\d{3})(\d{3})(\d{4})', '+90\1\2\3') address FROM public."PhoneFix_Cuno" WHERE createdate<'20210215' ORDER BY id DESC LIMIT 100;
[[:alpha:]] matches any alphabets '' is the replacement string 'g' instructs the function to remove all alphabets, not just the first one. Similarly, you can remove all digits in the source string by using the following statement:
SELECT REGEXP_REPLACE('ABC12345xyz','[[:digit:]]','','g'); Code language: JavaScript (javascript) And the output is: