Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I'm a beginner in talend. I want to pass data by removing unwanted characters present.
I'm having special character coming from source in one of my columns . I want to remove that and process the output. I tried using Treplace component. Tried even Tjavarow.
Can anybody please help me out?
Thanks in advance.
You need tu use a regex with String.replaceAll method in a tMap or tJavaRow component like this:
row1.before.replaceAll("[^0-9\\.]", "")Here is the result:
Démarrage du job test a 10:05 30/05/2018. [statistics] connecting to socket on port 3820 [statistics] connected .-------------+-----------. | tLogRow_49 | |=------------+----------=| |before |after | |=------------+----------=| |.23 |.23 | |100 |100 | |100. |100. | |100.23abc |100.23 | |2000.801246┬à|2000.801246| '-------------+-----------' [statistics] disconnected Job test terminé à 10:05 30/05/2018. [Code sortie=0]
Does this help?
can you try to replace with in tMap below funtion.
row1.column.replaceAll("a","")
or
row1.column.replace("a","")
You need tu use a regex with String.replaceAll method in a tMap or tJavaRow component like this:
row1.before.replaceAll("[^0-9\\.]", "")Here is the result:
Démarrage du job test a 10:05 30/05/2018. [statistics] connecting to socket on port 3820 [statistics] connected .-------------+-----------. | tLogRow_49 | |=------------+----------=| |before |after | |=------------+----------=| |.23 |.23 | |100 |100 | |100. |100. | |100.23abc |100.23 | |2000.801246┬à|2000.801246| '-------------+-----------' [statistics] disconnected Job test terminé à 10:05 30/05/2018. [Code sortie=0]
Does this help?
Thanks a lot mate. It worked with little addition to the expression. I've forgot to mention that i also have some Alphabets coming in that column which i need to pass.
So as an addition to the expression i"ve inserted a-zA-Z in your expression and it worked.
So this is the final expression
row1.before.replaceAll("[^0-9a-zA-Z\\.]", "")
Thanks again for taking time and replying to my post.
I've forgot to mention that i also have some alphabets coming in that column which i need to process it to output.Thanks for replying to my post.
I have source like this
sudhakar###!@gmail.com
manik@um%ar*@gmail.com
vijay@gmail.com
kumar@outlook.com
i want to differentiate the valid email data to one target and bad data is to another target
in tmap expression filter i used this logic StringHandling.Count(row1.email,"@")==1 ,then i got valid emails but i want to remove extra special characters