I often need to strip emoji from strings to prevent them from messing up other handling. Iβve been compiling regular expressions and I think I finally have all the bases covered.
This example is in Ruby, but the regular expressions are easy to adapt to any language:
Iβve already ported this to Swift and Python, and put together a repo intended to keep these as living documents that are updated to keep up with new emoji. If youβre into this kind of thing, please make pull requests as you discover new edge cases. You can create PRs against the [README.md][], which contains the main regular expression, or against any of the languages you use. And if you port this to any other language, please add a routine to the repo!
This is a companion discussion topic for the original entry at https://brettterpstra.com/2025/01/04/stripping-emoji-from-a-string