Comments (2)
Hey Andre,
although REGEX_ANY
does match a lot of emoji-related codepoints, it does not match some Unicode-codepoints that are used by emoji, but are also used outside of the emoji-world, like U+200D zero-width joiner. That's exactly what is happening here, there is still a ZJW in the data:
uniscribe 'š¤šÆš®šāāš¬š¶š¼šøšŖššØāš¾šŗšš¤Æ'.gsub(Unicode::Emoji::REGEX_ANY, '')
200D āā ]ā[ āā ZERO WIDTH JOINER
I've clarified this behavior in the README table.
What you want to do is to use REGEX
which gives you better (and more robust) results. For example:
uniscribe 'š¤šÆš®šāāš¬š¶š¼šøšŖššØāš¾šŗšš¤Æ'.gsub(Unicode::Emoji::REGEX, '')
Unfortunately, this will let through textual emoji like
2195 āā ā āā UP DOWN ARROW`
To work around this issue, you can also remove emoji that respond to REGEX_TEXT
, for example, like this:
'š¤šÆš®šāāš¬š¶š¼šøšŖššØāš¾šŗšš¤Æ'.gsub(Regexp.union(Unicode::Emoji::REGEX, Unicode::Emoji::REGEX_TEXT), '') == "" # => true
Please leave some feedback, if this fixes your issue.
Actually, your feedback inspired me to have a REGEX_ALL regex in a future version of this gem, which will include textual emoji in its regex, see #5
from unicode-emoji.
Closing, please re-open if problem persists
from unicode-emoji.
Related Issues (9)
- Write specs for + document non-regex constants in README
- `Unicode::Emoji::REGEX` allowing non-RGI sequence? HOT 2
- Incorrect matching of several family emojis HOT 2
- Seems like š«¶ might not be supported? HOT 3
- Adding support for new Emoji HOT 2
- New regex which includes textual emoji as well HOT 1
- Unicode Emoji Regexp on numbers HOT 2
- New architecture proposal to reduce memory usage HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unicode-emoji.