Skip to content

Instantly share code, notes, and snippets.

@gwarser
Forked from Alex-Just/strip_emoji.py
Created April 23, 2023 06:49
Show Gist options
  • Save gwarser/7df4cdede661392f224a6c05d1d807f0 to your computer and use it in GitHub Desktop.
Save gwarser/7df4cdede661392f224a6c05d1d807f0 to your computer and use it in GitHub Desktop.
Python regex to strip emoji from a string
import re
# http://stackoverflow.com/a/13752628/6762004
RE_EMOJI = re.compile('[\U00010000-\U0010ffff]', flags=re.UNICODE)
def strip_emoji(text):
return RE_EMOJI.sub(r'', text)
print(strip_emoji('🙄🤔'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment