Formula to remove Emojis from String/Feild

Hi

I currently have a ‘Name’ feild which contains emojis (for example ‘:sparkles: Misc :sparkles:’, ‘:paperclip: Life Admin Tasks :paperclip:’) , because of the nature of Emojis - this means that the feild cannot be sorted alphabetically.

Is there a way to remove emojis from a feild (for example to create a dedicated ‘sorting’ column which doesn’t contain the emojis)?

Thanks

Hi Martyn,

if your syntax is always the same : emoji + bank space + text, try this out :

Please let me know if I misunderstood !
EDIT : Yes I misunderstood, you have emoji at the beginning AND at the end. I’m checking that !

Quentin

OK Sorry Guy.
This time I assume your configuration is EMOJI + Blank + string text + Blank + EMOJI


Formula
First Emoji > thisRow.Name.Split(" ").First()
Second Emoji > thisRow.Name.Split(" ").Last()
Result > RegexReplace(RegexReplace(thisRow.Name,thisRow.[1st Emoji],"" ),thisRow.[2nd Emoji],"")

if you do not have a space between the emoji and the text then the Split(’ ') wont work. but if the emojis occupy the first and last positions of the text then you can remove them using the Middle() function.

but you must be aware that each emoji is actually encoded as 2 characters so you need to remove 2 characters from the start to get a sortable text string…

Name.Middle(2)

max

4 Likes

For the sake of completeness, you could also use a long regex replace like this:

stringValue.RegexReplace(
  "([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])", 
  "")
.Trim()

I don’t know if this works for literally all emoji, but it worked for the few I tested.