The following expressions check if the incoming string matches the format specified using REG_MATCH(). If it does match it uses REG_EXTRACT to extract parts of it and give the output formatted as 123-456-7890 –H or else it returns ‘NO MATCH’.
If the phone number of source is 1234567890, REG_EXTRACT(phone1_type, '(\d\d\d)(\d\d\d)(\d\d\d\d)',1) will extract 123, REG _EXTRACT(phone1_type, '(\d\d\d)(\d\d\d)(\d\d\d\d)',2) will extract 456 and REG_EXTRACT(phone1_type, '(\d\d\d)(\d\d\d)(\d\d\d\d)',3) will extract 7890 according to the third argument specified for this function. i.e. the third argument states which sub-expression specified within () should be returned by the function.