How to remove smileys/emojis from a string?

Highlighted
Five Stars

How to remove smileys/emojis from a string?

Hi All,

 

I have problem loading data from salesforce to mysql database. My data looks like below:

Data:  Hey, Please can this one be updated our side? 😊

I have created a simple one-to-one mapping. Tsalesforce input and tdboutput. 

I want to replace the smiley/emoji present in the string with a blank space. I am currently using tjavarow but it is not working. Any help on this will be really appreciated.

Employee

Re: How to remove smileys/emojis from a string?

Hi,

 

Please try below method.

image.png

 

image.png

 

image.png

 

You need to use the below value for context variable.

 

"[^\\p{L}\\p{M}\\p{N}\\p{P}\\p{Z}\\p{Cf}\\p{Cs}\\s]"

The function used in tMap is as below.

 

row1.input.replaceAll(context.characterfilter,"")

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

 


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 :-)
Employee

Re: How to remove smileys/emojis from a string?

Hi @ikan 

 

     Could you please mark the topic as resolved since I have answered your query?

 

     Marking a query promptly will help others in Talend community when they are looking solutions for similar queries.

 

     It is also a way of telling thank you to the contributor for spending their time for your query in between their routine work.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


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 :-)
Five Stars

Re: How to remove smileys/emojis from a string?

Hi Nikhil,

Thanks for your help.
But I still get error while loading data. All the smileys are not replaced.
Could you check my previous message and help please.
Employee

Re: How to remove smileys/emojis from a string?

Hi,

 

   Could you please try below value to the context variable?

 

"[\\ud83c\\udc00-\\ud83c\\udfff]|[\\ud83d\\udc00-\\ud83d\\udfff]|[\\u2600-\\u27ff]"

Please refer the details in below link. You may have to add additional regular expressions based on your emoji if this is also not clearing the emoji.

 

https://stackoverflow.com/questions/44620294/removing-special-character-from-java-string

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


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 :-)

Cloud Free Trial

Try Talend Cloud free for 30 days.

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.