
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
In DataPrep, there is a function called "Remove non alpha numeric characters".
Best regards,
Vincent

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vincent,
I don't see anything as such in expression builder.
Would you please show me with screen shot?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All, @TRF, @manodwhb, @nthampi
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe you already got the way forward in the below post?
Warm Regards,
Nikhil Thampi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Input value is : "*éÉÇçÀà~@%#ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ/!@#$%?*()+Hi this is Yash"
Required Output is: Hi this is Yash
For this tMap Expression is: row.column.replaceAll("[^a-zA-Z]", " ").trim()
So that it can remove special characters and it gets only alphabetic data (small a-z and CAPITAL a-z).
And .trim() function is to remove blank spaces.
Thanks and Regards
Yashwanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI @Fred Trebuchet
I want to replace comma from a column of csv file.
Like i have field "f,lactuation" i need to convert it into "f lactuation"
i have tried row1.inputcolumn.replaceAll(",", " ") in tmap and in tjavarow but got no change.
