Start a new topic

Using regex to translate phone #

Some of our donors enter phone # like 4164164416 or 416-416-4416.How can I use regex to change them to or format (416)416-4416 when I import to RE. 

Hi Catherine,

You can use this dictionary:

Replacement Value: --BLANK-- (just press the + in the Replacement value to get the BLANK value)
Value to match on: \D

This removes from the string anything that is not a number.

Then RE will apply the phone number formatting set up in your phone types table.

Please let me know if you have any questions!

Thank you,
Amanda
Omatic Support

Hi Amanda:

I tried on my computer, and tested it. It doesn't work. I don't know why. I enter 416-416-4416. computer text is still the same 416-416-4416.

Catherine

Hi Catherine,

Did you check the "Use Regular Expressions" checkbox? Following Amanda's suggestion worked on my machine:

image

It works. Thank you.

Shouldn't RE already do this if you have set up the format on the phone type you are importing?

Hi:

Does anybody know how to translate postal code from M8V2E7 to M8V 2E7? Adding space.

Thanks!

Hi Catherine,

This should work for you:

Replacement Value: $1 $2
Value to match on: (^[A-Z]{1}\d{1}[A-Z]{1}(?=\d{1}[A-Z]{1}\d{1}))((?\d{1}[A-Z]{1})\d{1}[A-Z]{1}\d{1}$)

This will look for a format of letter number letter number letter number, just in case you have other zip codes for other countries.

Don't forget to check the "Use regular expressions" checkbox. Please let me know if you have any questions! 


Thank you,
Amanda
Omatic Support
Hi Amy,

Great question! This one should work:

(^[aA-zZ]{1}\d{1}[aA-zZ]{1}(?=\d{1}[aA-zZ]{1}\d{1}))((?
Then apply the Uppercase function on the row as well. This is the column just to the right of the dictionary column.

Thank you,
Amanda
Omatic Support
Hi Amy,

You should only need the second one since it includes both upper and lower case letters. Then the uppercase function in the profile will convert the letters to uppercase.

Please let me know if you're still having trouble with this one.

Thank you,
Amanda
Omatic Support
Hi Amanda:

It doesn't work to use second one. Maybe we use it wrong way. the first one works.

Catherine

Hi Catherine,

The string isn't being split into the two pieces as it is below?

image


Thank you,
Amanda
Omatic Support

No, it didn't split
Hi Catherine,

Please double click to open the Values to match on. Place your cursor in the field and make sure there aren't any extra spaces at the beginning or end of the string. It may help to copy and paste it again, making sure there aren't any extra spaces anywhere.

If you're still having trouble with this dictionary, please export and send it to support@omaticsoftware.com so I can take a look at it. To export the dictionary, right click and choose export dictionary. This will create a .csv file that you can send as an attachment.

Thank you!
Amanda
Omatic Support
Thanks Amy and Amanda. It works now.Same as Amy's
Login or Signup to post a comment