I have set up a webhook that sends me the subject, body, sender information, date, etc for each new email a brand sends to my email.
Now I have a yes/no filed in my database for subjects with emoji. So, Is there a way to identify a subject line (text field) containing emoji? If yes, it should change the field to yes or else no.
Additionally, what could be the easiest way to store different emojis in my database so that I can then show the most commonly used emoji by a brand in UI?
Let me know if I am not able to communicate my problem clearly.
Share a screen shot of the actual returned values from the api call (such as the raw data seen when you first initialize the call) for the raw data as often times emojis might be sent with some sort of code applied to it.
You can do this using Regex because the Unicode Consortium has practically converted everything into Unicode. You can find the references for each emoji on their website. For example, U+1F600 corresponds to .
The regex code most accepted by the community for this use case is: <:[^:\s]+:\d+>|<a:[^:\s]+:\d+>|(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|\ufe0f)
In this case, you should not insert :formatted as text if you want to save it as yes/no in the database; I only did that for visual appeal. It will automatically save as yes if there are 1 or more emojis.
So, each time the Regex finds 1 or more emojis, it will return a yes:
WITHOUT EMOJIS
WITH EMOJIS
I assume you want to extract emojis from emails and display the most used ones… Here’s a total guess since I can’t test it: I believe you can do this by creating a new data type called Emojis and within that type, create a text field called Emoji. Then, for each emoji returned by the extract with regex function, create a new entry in the database. To display the most used emojis on the user interface, group by emojis and show the count.
Thanks a ton. The first solution worked perfectly to identify the use of emoji.
Regarding, displaying the most used emojis, I have a created a data type called with field emoji (text field), and email (reference to email data type).
Now I am not able to figure out how will i create a separate entry for different emoji. Any idea how i will extract the emoji with similar regex function and create separate entry for each emoji?