Forum Discussion
Remove Emojis from Open Text Field
Hi CharleyKirton ! To remove emojis from a text string in Power Query, you can use the Text.Replace function. You can use a regular expression pattern to match any emoji in the string, and replace it with an empty string. Here's an example of how to do that:
let
// Define the text string that contains emojis (just as an example in this case)
text = "This string contains some emojis ππππππ
π€£ππππππ",
// Use a regular expression to match any emoji in the string
emojiPattern = "[\uD83C-\uDBFF\uDC00-\uDFFF]+",
// Use the Text.Replace function to replace all the matched emojis with an empty string
result = Text.Replace(text, emojiPattern, "")
in
result
The regular expression used in this example will match any Unicode characters in the range U+D83C to U+DFFF, which covers all the emojis in the Unicode standard. The Text.Replace function will then replace any matched characters with an empty string, effectively removing the emojis from the text.
Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution βοΈ or giving it a kudoe π
Thanks!
You can also check out my LinkedIn!
Best regards,
GonΓ§alo Geraldes
Hi goncalogeraldes
Thanks for getting back to me!
I'm struggling to make it work at the moment: I put your code into a blank query with some emojis in the text string and it still returned the emojis, so perhaps they're emoticons or something instead?!
Where are you getting the uD83C - uDBFF etc bit from? I could only find ones like U+1F300 - U+1F5FF (which features the below wave image) but I tried those with and without the + included and still got the symbols returned so not sure what I'm doing wrong. Any ideas?