Phone Number Format

I would like to change the format of this phone number 6505615622 to the format below. Is there a best way to do this with EDT? Thank you.

1-(650)-561-5622

There might be clever solution using regular expressions or the Javascript transformation. I didn’t see any standard transformation to do so and have only a really lousy suggestion.

image

Phone Number format (US).transform (5.7 KB)

2 Likes

I was thinking there might be a good regex too for this. Thank you.

You can do it with Replace. There is an example of almost exactly this in the Replace documentation.

2 Likes

One way of doing it through Regex is already provided by @Admin and here is another way.

Set Replace transform as follows

Match Type : Regex
Put in Replace : (\d{3})(\d{3})(\d{4})
Put in With : 1-(\1)-\2-\3

It will transform 6505615622 to your desired output of 1-(650)-561-5622

3 Likes

Thank you for the help.

Ok, thank you for the help.

1 Like

@Anonymous has a more elegant solution. As usual. ;0)

2 Likes