How to remove smileys/emojis from a string?

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

 

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

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

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

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

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now