How to remove special characters in the string

Six Stars

How to remove special characters in the string

Hi Folks,

 

I am new to Talend and need one help from you guys.

 

How to remove the special character in a string field?

 

Like for example I have the input like -> 988788-99999

 

How do I get the output like below,

98878899999

 

Regards,

Deepak

 


Accepted Solutions
Forteen Stars TRF
Forteen Stars

Re: How to remove special characters in the string

Hi,

Using a tMap with the following expression you should get the expected result:

row1.inputField.replaceAll("\\D", "") 

This will replace each non-digit character by nothing.

Here is a link to regular expression tutorial http://www.vogella.com/tutorials/JavaRegularExpressions/article.html

 

Hope this helps.


TRF

All Replies
Highlighted
Employee

Re: How to remove special characters in the string

Hello,

 

In DataPrep, there is a function called "Remove non alpha numeric characters".

 

 

Best regards,

 

Vincent

Six Stars

Re: How to remove special characters in the string

Hi Vincent,

 

I don't see anything as such in expression builder.

 

Would you please show me with screen shot?

 

workflow1.PNG

Employee

Re: How to remove special characters in the string

Hello Deepak1,

 

if you are using Talend Open Studio, you can use tReplace in your job. In advanced mode, you can provide a regular expression.

 

Once you have a regular expression, that matches your 'special characters', you can replace them with an empty string.

 

Here is the link to the tReplace help : https://help.talend.com/reader/hm5FaPiiOP31nUYHph0JwQ/jh3P41SE4Or9NQ0J0Gkfsg

 

Best regards,

 

Vincenty

 

Forteen Stars TRF
Forteen Stars

Re: How to remove special characters in the string

Hi,

Using a tMap with the following expression you should get the expected result:

row1.inputField.replaceAll("\\D", "") 

This will replace each non-digit character by nothing.

Here is a link to regular expression tutorial http://www.vogella.com/tutorials/JavaRegularExpressions/article.html

 

Hope this helps.


TRF
Seven Stars

Re: How to remove special characters in the string

Hi All, @TRF@manodwhb@nikhilthampi

Can you please tell me how to replace below characters with empty string:

"*éÉÇçÀà~@%#ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ/!@#$%?*()+"

 

My Input value is : Column1 = "*éÉÇçÀà~@%#ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ/!@#$%?*()+This is the value"

 

My required Output is: Column1 = "This is the value"

 

How to do this? please help.

Employee

Re: How to remove special characters in the string

@joe86

 

I believe you already got the way forward in the below post?

 

https://community.talend.com/t5/Design-and-Development/Remove-special-Characters-from-a-column-value...

 

Warm Regards,

 

Nikhil Thampi


Warm Regards,
Nikhil Thampi
Please appreciate our members by giving Kudos for spending their time for your query. If your query is answered, please mark the topic as resolved :-)

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

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