RegEx - tmap

Highlighted
Five Stars

RegEx - tmap

I have a field called Name which I am pulling from Salesforce.  This field is annotated with a date/time stamp which is fine, but in order for me to use that field as a lookup, I need to completely remove the date/time stamp any space(s) in the end of the string.  For example:

the string = somenamehere with spaces2019-10-05 07:01:09

tmap=row3.Name.replaceAll("\\d[:-]*","")

results = somenamehere with spaces

the results above has an extra space - might be hard to see --which I am running out of options on how to get rid of it.

My output file is a txt file with a field separator of a semi colon.

 

Any suggestions folks on how to setup my RegEx?

 


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: RegEx - tmap

(row3.Name.replaceAll("\\d[:-]*","")). replaceAll(" $", "")

TRF
Five Stars

Re: RegEx - tmap

Thank you so much.

 

Your way works better - before i saw this i had everything but . replaceAll(" $", "")

And I was using .trim() which wasn't consistent with some of the names in the file. - Thanks again.  


All Replies
Fifteen Stars TRF
Fifteen Stars

Re: RegEx - tmap

(row3.Name.replaceAll("\\d[:-]*","")). replaceAll(" $", "")

TRF
Fifteen Stars TRF
Fifteen Stars

Re: RegEx - tmap

Did this help?
If so thanks to mark your case as solved.

TRF
Five Stars

Re: RegEx - tmap

Thank you so much.

 

Your way works better - before i saw this i had everything but . replaceAll(" $", "")

And I was using .trim() which wasn't consistent with some of the names in the file. - Thanks again.  

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog