One Star

telephone number conversion

in our system user can input various telephone numbers in free text.
I'd like to create a job, which iterates all numbers and applies a set of easy to maintain rules for cleaning/replacement,
to get as many as possible number into a fixed standard format in the output.
Are there any components that help me do so?
2 REPLIES

Re: telephone number conversion

If you take a look at the TOP (talend open profiler) regexes there are many dealing with validating telephone numbers from around the world. you can take these regexes and embed them wherever you need to validate and clean telephone numbers
One Star

Re: telephone number conversion

I put up a blog post on integrating Google's phone number handling code (libphonenumber). If you add this JAR to Talend via tLoadLibrary, you'll get phone number format support for 228 countries and regions. http://bekwam.blogspot.com/2011/03/formatting-phone-numbers-in-talend-open.html
The library can be found here: http://code.google.com/p/libphonenumber/downloads/list. I built the 3.0 jar.
The integration uses a tJavaRow to create some PhoneNumber objects parsed from strings created by a tRowGenerator. These PhoneNumber objects can be outputted in parts (country code, etc.) or using some standard phone number formats.
	PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();

PhoneNumber col1_pn = phoneUtil.parse(input_row.usPhoneCol1, "US");
PhoneNumber col2_pn = phoneUtil.parse(input_row.usPhoneCol2, "US");
PhoneNumber col3_pn = phoneUtil.parse(input_row.usPhoneCol3, "US");

output_row.usPhoneCol1 = phoneUtil.format(col1_pn, PhoneNumberFormat.NATIONAL);
output_row.usPhoneCol2 = phoneUtil.format(col2_pn, PhoneNumberFormat.NATIONAL);
output_row.usPhoneCol3 = phoneUtil.format(col3_pn, PhoneNumberFormat.NATIONAL);

usPhoneCol1 is "(301) 555-5555", usPhoneCol2 is "3015555555", and usPhoneCol3 is "301.555.5555". All three columns format() to "(301) 555-5555".
-Carl