removing unwanted charcters

Highlighted
Five Stars

removing unwanted charcters

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?Capture.PNG

Thanks in advance. 


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: removing unwanted charcters

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?


TRF

All Replies
Forteen Stars

Re: removing unwanted charcters

@snishtala,

 

can you try to replace with in tMap below funtion.

 

row1.column.replaceAll("a","")

or

row1.column.replace("a","")

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Fifteen Stars TRF
Fifteen Stars

Re: removing unwanted charcters

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?


TRF
Five Stars

Re: removing unwanted charcters

@TRF

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.

 

 

Five Stars

Re: removing unwanted charcters

@manodwhb

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.

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