- Emojiguide.com
- FAQ
- Emojis for Developers
- How do I match an emoji with regex?
How do I match an emoji with regex?
Use the Unicode property \p{Emoji} — supported in JavaScript (with the u flag), Python (with the regex module), Ruby and PHP. Example in JS: /\p{Emoji}/gu.test("🎉"). For strict matching including ZWJ sequences, libraries like emoji-regex are the easiest route.
Related questions in Emojis for Developers
- How do I write an emoji in HTML?
- What is an emoji's Unicode code point?
- What is a ZWJ emoji sequence?
- How do emoji skin-tone modifiers work?
- Can I use an emoji in CSS?
- How do I use an emoji in JavaScript?
- How do I use an emoji in Python?
- Can I put emojis in JSON?
- Can I put an emoji in a URL?
- How many bytes is an emoji?