Hi there,
I'm trying to use the search and replace tool to remove any and all emoji from my text. With numbers I can easily use something like "[0-9]" to work with a range of numbers, is there something similar for emoji?
Thank you!
You might try searching for the regular expression [^\w\d\s[[:punct:]]]
, which should find anything that is neither a letter, digit, space, or punctuation, and replacing it with nothing.
That's perfect! Thank you so much
hey sorry to reopen but how would you do the same and just remove the emoji, so not replacing it with nothing. As that then leaves a space where that emoji was, say I just want to remove the emoji fully
No problem to reopen. However, I think you must have unwittingly typed a space in the replace field, because replacing the emoji with nothing shouldn't leave a space where that emoji was:
I don't write anything in the replace field so unsure why I'm getting this whitespace. Attached I tried to replicate yours, and still having it should incorrectly. Could you perhaps share the macros so I can direct import it?TEST.kmmacros (1.8 KB)
Aha, I see what the issue is now. The problem is that you happened to be using an emoji that included a nonspacing mark character, which caused the preceding space character to look like one giant space once the emoji was gone. Though they look identical to us, this version of the emoji is only one character:
while this one, which you were using in your test macro, is actually two:
⚡️
If you use the version that's only one character, you can see that your macro was actually working fine:
If you want to account for this nonspacing mark character in the future, you can use this modified regex, which accounts for that character and deletes it as well:
[^\w\d\s[:punct:]]|\uFE0F