-
-
Save casualuser/c6448934fea7bf47e2170c8b431eab7f to your computer and use it in GitHub Desktop.
Python regex to strip emoji from a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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