regex replace

One Star

regex replace

Hello Everybody,
I want to use regex to mask somme caractere. For exemple, I have this model : 0000 zzzz 0000 yyyy 0000
that's mean that the 4 first positions( first bloc ) will not be replaced and also the third and the fifth.
For the second bloc, i will replace mask using "z".
For the 4th bloc, I will replace by "y".
How can I do it with talend?
thank u for help
Moderator

Re: regex replace

Hi,
Could you please check the component tFileInputRegex to see if it what are you looking for?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: regex replace

Could you please show me a example coz I'm newbie in Talend.
Thank you
One Star

Re: regex replace

Could somebody help me to find a solution for my problem.
Thank you
One Star

Re: regex replace

hey,
try (input)------tNormalize----tSampleRow--------tReplace (or tJavaRow)
in tNormalize choose " " as separator and in tSampleRow choose line 2 and 4 with "2,4", then use tReplace or tJavaRow.
One Star

Re: regex replace

or just do in a tMap
input_row.your_column.susbtring(0,6) + " " + input_row.your_column.susbtring(input_row.your_column.length()-6,input_row.your_column.length())
Seventeen Stars

Re: regex replace

hi,
using substring, if pattern change the result will be wrong or a bound exception.
So could be if the format is quite "static".
regards
laurent
One Star

Re: regex replace

It's not a static, the model is dynamic . I managed to do that :
4567 - ZA15 - B985 - 7413 - C5D4 but it replaces juste one time!!!
How can I do it many times
Thank you

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch