Skip to content

Clean up US phone numbers

Ryan TG edited this page Oct 5, 2021 · 1 revision

If a phone number is formatted like 1112223333, then we want it to be 111-222-3333.

update locations set phone = regexp_replace(phone, '(\d{3})(\d{3})(\d{4})', '\1-\2-\3') where phone !~ '[^0-9]+' and length(phone)=10 and country='US';