Start a new topic

Formatting UK phone numbers

Hi all,

 

I have a rather complicated request about phone number formatting! I'd like to be able to split phone numbers in our preferred format when being imported into Raiser's Edge. The problem I have is that the position of the spaces varies based on how the phone number begins. So for example:

 

020 1234 5678

0115 123 4567

01773 123456

07904 123456

 

Is it possible to have a regular expression that splits the number based on the first 4 or 5 digits, or can we do that via the code editor?

 

Any advice appreciated!

 

Thanks,

 

Hannah


What is the logic behind the spaces? When do you use two or three and when do you leave 3/4/5 numbers at the beginning?

Hi Wayne,

 

The standard formatting in the UK varies depending on the length of the regional dialling code (London's being 020, Nottingham's being 0115 etc.) and it's easier for our staff to make outbound calls if the digits are grouped correctly and the broken down from the 11 digit block we receive in our data.

 

There are 5 dialling codes with 3 digits, 6 with 4 digits, and then all others should begin with 5 digits. Ideally we need a "if phone number begins with 020 or 023 use format A, if it begins with 0115 or 0117 use format B, else use format C" type rule but I'm not sure how best to achieve this.

 

Thanks,

 

Hannah

 

Ok, here you go

Replacement Value 1 (Regex ON):
$1 $2 $3
Values to Match 1:
^(020)(\d{4})(\d{4})$
^(023)(\d{4})(\d{4})$
^(0115)(\d{3})(\d{4})$
^(0117)(\d{3})(\d{4})$

Replacement Value 2 (Regex ON):
$1 $2
Values to Match 2:
^(\d{5})(\d{6})$
That's fantastic, thanks so much for your help Wayne!
Login or Signup to post a comment