tMap extract customer number from string

One Star

tMap extract customer number from string

I have a source cvs report that looks like this:
JOHN DOE COMPANY (144333),2344,1233,1233
I had to extract the customer number between parentheses, so I did:
StringHandling.LEFT((StringHandling.RIGHT(row1._Sales,7)),6) directly on the tMap field to match the customer number and get the ID as a lookup.
Now I have brought in another region that has 2 more digits on the customer number, so my previous solutions doesn't work. I've spent a good 5 hours reading solutions, but can't seem to find a solution. I'm not that good with regex and I want to make sure that I get the extraction right.
Please help!
One Star

Re: tMap extract customer number from string

Try this
String foo = "JOHN DOE COMPANY (144333),2344,1233,1233";

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach


Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.



Introduction to Talend Open Studio for Data Integration.