mathiasbynens / emoji-regex Goto Github PK
View Code? Open in Web Editor NEWA regular expression to match all Emoji-only symbols as per the Unicode Standard.
Home Page: https://mths.be/emoji-regex
License: MIT License
A regular expression to match all Emoji-only symbols as per the Unicode Standard.
Home Page: https://mths.be/emoji-regex
License: MIT License
I'm writing a chat-like application, and I need to check if a string consists only of Emoji characters, so that I could render the emoji in large text.
Currently I'm using a function like the following to do this:
function isEmojiOnly(text, emojiRegex) {
const textOnly = text.replace(/\s/g, "")
return textOnly.replace(emojiRegex, "") === ""
}
Does the emoji-regex library offer any provision to do this more optimally?
Male detective emoji, ๐ต๏ธ "\u{1f575}\ufe0f"
, when matched with emoji regex, not all of its codepoints are consumed, leaving \ufe0f
behind. The emoji is typed with control+cmd+space shortcut of Mac.
"\u{1f575}\ufe0f".match(emojiRegex(), "").length
//> 1
Hi Mathias,
Profession emojis which include gender type don't match, such as:
https://emojipedia.org/female-construction-worker/
https://emojipedia.org/female-health-worker/
Is it about the generated regex or emoji version or anything else?
Thanks!
I was looking through some project regex and found this one here. It seems to be trying to use \p{ to express a unicode value but this notation is not supported in the JS regex dialect and will most likely not behave as expected when interacting with the u flag.
I have a patch ready for this, that Iโll commit once @alexeld bumps the regex-trie version number.
With this change, the index.js
file size goes from 7079 bytes down to 2867 bytes! ๐
the regex does not match this special character: https://www.compart.com/en/unicode/U+232B
Julien
This otherwise wonderful and highly useful regular expression seems to be missing a number of modern / new Emoji included in Unicode 9 / Emoji 3.0. The missing emojis include the popular Rolling on the floor laughing (:rofl:) and Nauseated Face (:nauseated_face:), as well as others.
Any chance we can get these new ones added to the regex?
Thanks for an awesome library!
- Joe
Skin tone modifiers seem to break this. ๐๐ฟwill not be matched by the regex <_<
When matching a string for emojis, the returned match does not include the entire emoji.
For example,
let emojiString = 'peace hand -> โ๏ธ';
let match = EmojiRegex.exec(emojiString);
console.log(โ๏ธ===match[0]); //false
Instead match[0] returns
โ
The match doesn't include the entire emoji.
An emoji consists of 2 16-bit code points, but for some emojis, only the first code point is matched and returned, giving these weird emojis in browsers.
(A couple of minutes in https://thekevinscott.com/emojis-in-javascript/ , and I can pretend to know anything about emojis ๐ )
As suggested here I started using emoji-regex/text
to detect all emojis. However, when using emoji-regex/text
the regular expressions starts failing by thinking numbers are emojis as well.
you can try '\u263a'.match(regex)
and '\u263a\ufe0f'.match(regex)
result:
'\u263a\ufe0f'
can match, but '\u263a'
canโt
Hello!
I found two issues with v7.0.1 regular expression.
I try to parse such string โฟ๏ธ๐๐๐๐บ๐๐ฏ , then I get array of emojis that when I join I get string of 13 symbols. When original emojis has 14 symbols.
So after parsing was lost 'VARIATION SELECTOR-16'
I used text.js
for working with variations
Following up on this tweet:
I'm using emoji-regex to identify if the last symbol of a string is an emoji. While this works for most emojis, it does not for โฝ๏ธ
. As it turns out this is happening because macOS inserts U+26BD
followed by U+FE0F
and that trailing variation selector is not part of the emoji-regex match.
While I don't think this is a bug in emoji-regex I do believe emoji-regex could help avoid this situation by including the unnecessary variation selector in the match.
Hey there,
Love this library, but I've been seeing some new(er) emojis that are not matched correctly?
import emojiRegex from 'emoji-regex'
const e = emojiRegex()
e.test('๐') // false
Thanks,
Brekk
Another Emoji that don't match properly:
it match only first character โ
This regexp is not useful when you want to match just emojis... because then you have a 0 and this library will think "oh yeah 0 could be an emoji as 0๏ธโฃ" but thats not what I was expecting.
if regexp '0'
return false
if regexp '0๏ธโฃ'
return true
Hi there,
It looks like the release cut after #22 (v6.5.0) was merged perhaps didnโt have dependencies bumped correctly when it was built, as the es2015 modules donโt match the output I expected!
They should start with;
module.exports = () => {
// https://mathiasbynens.be/notes/es-unicode-property-escapes#emoji
return (/\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074})\u{E007F}|\u{1F469}\u200D\u{1F469}\u200D.../gu
);
};
But instead begin;
module.exports = () => {
// https://mathiasbynens.be/notes/es-unicode-property-escapes#emoji
return (/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74)\uDB40\uDC7F|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|โฆ/gu
);
};
Could you do a new release and double check the dependencies (regexgen in particular!) are up to date? Unfortunately thereโs no spec checking the format of the regex! ๐
This project seems to be out of date. Any plans to update it to the latest emoji standard? If not, know of an alternative library?
I tested, all emojis available on iOS 9.1 / OS X 10.11.1 and it is failing to detect emoji numbers:
\u0030\ufe0f\u20e3
\u0031\ufe0f\u20e3
\u0032\ufe0f\u20e3
\u0033\ufe0f\u20e3
\u0034\ufe0f\u20e3
\u0035\ufe0f\u20e3
\u0036\ufe0f\u20e3
\u0037\ufe0f\u20e3
\u0038\ufe0f\u20e3
\u0039\ufe0f\u20e3
\u0023\ufe0f\u20e3
\u002a\ufe0f\u20e3
As typed
0๏ธโฃ
1๏ธโฃ
2๏ธโฃ
3๏ธโฃ
4๏ธโฃ
5๏ธโฃ
6๏ธโฃ
7๏ธโฃ
8๏ธโฃ
9๏ธโฃ
#๏ธโฃ
*๏ธโฃ
This seems to be a similar case to #13, so possibly it's a more-specific instance of devongovett/regexgen#10.
Sequences such as ๐ฉโ๐งโ๐ฆ (U+1F469 U+200D U+1F467 U+200D U+1F466
aka "family: woman, girl, boy") match all but the last symbol:
const wgb = '\u{1F469}\u200D\u{1F467}\u200D\u{1F466}';
wgb.match(emojiRegex());
/*
Result:
[
'๐ฉโ๐ง', U+1F469 U+200D U+1F467
'๐ฆ' U+1F466
]
*/
I decided to check all sequences using the same looping tests as the other symbols:
// Test a ZWJ emoji sequence (`emoji-zwj-sequences.txt`).
test('\u{1F3CA}\u{1F3FD}\u200D\u2640\uFE0F');
+ // Test all emoji sequences
+ const sequences = require('unicode-tr51/sequences.js');
+ for (const sequence of sequences) {
+ test(sequence);
+ }
This produces 86 failures, all to do with partial matches.
How can I fix it? I already read it.
const emojiRegex = require('emoji-regex/text.js')
console.log(emojiRegex().test('1')) // true
Would be awesome if you could add ES6 syntax to the README for convenience.
I'm sure there's a reason for this, but my app needs them to match.
Would you consider an optional parameter that would also match these characters? Maybe something like:
emojiRegex({includeNotTechnicallyEmojiCharacters: true});
I'd be happy to put the PR in, just wanted to check if this is a desirable feature.
Tested the regex expression using http://regex101.com/. Can closeout if it is not an actual issue.
Looks like the script doesnโt match the character properly:
'<p>Foo ๐โ๐จ Bar</p>'.replace(emojiRegex(), function(match) {
return '<b>' + match + '</b>';
});
// โ <p>Foo <b>๐</b>โ๐จ Bar</p>
Is it possible to write
import emojiRegex from 'emoji-regex'
instead of
const emojiRegex = require('emoji-regex')
?
If so, could you add this to the readme! Cheers!!
๐ผ doesn't seem to be matched by the regex.
Thanks for this wonderful library btw.
@mathiasbynens could be possible please to have a regexp to just match emojis? for example
0 is not 0๏ธโฃ
๐ฑโ๐ค is ๐ฑโ๐ค
๐ฑโ๐ค is not ๐ฑ+๐ค
Thanks!
See example here https://runkit.com/4ver/issue-with-emoji-regex-and-matching
Hi! Im trying to wrap emojis in a span tag, but some emojis break.
When I do
console.log('๐ฑโ๐ค'.replace(emoji_text_regexp, '<span class="emoji-native">$1</span>')
I get
<span class="emoji-native">๐ฑ</span>โ<span class="emoji-native">๐ค</span>
instead of
<span class="emoji-native">๐ฑโ๐ค</span>
is possible to use this library to wrap emojis with their modifiers? Thanks!
import emojiRegex from 'emoji-regex';
console.log(emojiRegex.test('1')); // output: true
using the library I'm trying to find out if a text has only emojies
this is the way I try to do it:
import emojiRegex from 'emoji-regex/es2015/text'; // can be the regular version as well (not the text one)
later, I'm going through all the matches and accumulating each match's length (to sum up the code points)
at the end I'm comparing the original text's length and the accumulated length as follows:
let totalEmojiesLength = 0;
let match;
while ((match = regex.exec(this.data.body))) {
const emoji = match[0];
totalEmojiesLength += [...emoji].length;
}
if (this.data.body.length === totalEmojiesLength) {
return true;
}
return false;
However, for some emojies, e.g. ๐, โ๏ธ and some more, only the first code point is returned, so the length of the emojies is wrong.
it looks like a bug for those emojies that their match doesn't return all their code points
and follow-up question - is there any other way to test if a text has only emojies using the library? I didn't find one and my solution isn't really effective performance wise...
related to #35
Hi, I'm using your library to match emojis. the problem is about matching some emojis I think are standard emojis. some of them is listed below:
Does the library matched with them? Is there any way to add them to regex?
Hi Mathias โ I have scoured the internet and this project seems very close to what I am trying to solve with Google Sheets. When I export my spreadsheets to a third party app that crunches the data, it will always spit out an error code if my written content has emojis. The app isn't coded to parse them!
I'm looking for a way to regex Find/Replace all emojis from Google Sheets. I am so sorry if this is not exactly an "issue," but I am very new to thisโplease take pity!
First, I want to thank you for great projects :)
I am using for emoji usage analysis!!
There is a tiny problem when installing... because of same name of module and package ( emoji-regex) ///
when I tried to install with "npm install emoji-regex"
code ENOSELF
npm ERR! Refusing to install package with name "emoji-regex" under a package
npm ERR! also called "emoji-regex". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm
npm ERR! A complete log of this run can be found in:
I write this because there is no issue regarding this....
Also For those who experiencing same problems :
When switching module (in package.json) into different name or project name(re- git clone is easiest) , it can work.
Free to comment!
For instance, the regex will match ๐ง๐ผโ๐คโ๐ง๐ป ('\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}\u{1F3FB}'
), but it doesn't match ๐ง๐ปโ๐คโ๐ง๐ผ ('\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}\u{1F3FC}'
). It seems to only work if the darker skin tone is on the left side. There are some more emojis that support multiple skin tones coming, so it would be great if this could match against all possible combinations.
Since the project specifically mentions nodejs so I wanted to confirm if this can be used on client side (ie. major desktop+mobile browsers).
My use case is to insert a space next to the character typed in by user as soon as they do that. Can this module help me with that or I'm on the wrong track?
When the string has number inside, emoji-regex/text matches it
version 6.4.0
var emojiRegex = require('emoji-regex/text');
const matchExpected = emojiRegex().exec('foo');
console.log(matchExpected)
// null
const matchUnExpected = emojiRegex().exec('foo123');
console.log(matchUnExpected)
// [ '1', index: 3, input: 'foo123' ]
``
First of all, thanks for this project! It's very useful.
It appears that the regex even matches codepoints that are followed by a text variant selector (FE0E).
The exclamation mark is an emoji with emoji-default representation. It should be matched both without a variant selector and with an emoji variant selector (FE0F).
However, it should not be matched when followed by a text variant selector (FE0E).
let m: string[];
console.info('no variation');
const r1 = emojiRegex();
while ((m = r1.exec('\u2757')) !== null) {
console.log('match', m, 'lastIndex', r1.lastIndex);
}
const r2 = emojiRegex();
console.info('text variation');
while ((m = r2.exec('\u2757\ufe0e')) !== null) {
console.log('match', m, 'lastIndex', r2.lastIndex);
}
const r3 = emojiRegex();
console.info('emoji variation');
while ((m = r3.exec('\u2757\ufe0f')) !== null) {
console.log('match', m, 'lastIndex', r3.lastIndex);
}
This will match the emoji 3 times, each time with length 1.
My expectation would be that the version without variant selector is matched with length 1, that the version with emoji variant selector is matched with length 2, and that the version with text variant selector is not matched at all.
When trying to use emoji-regex to replace certain characters, some data is left in the resulting string:
"โค๏ธ".replace(emojiRegex(), ' ').length; // 2
Although it will match, it doesn't appear to match the entire "string".
Thanks for providing the library, we notice that some emoji no longer match the regex after the latest version publish.
Not sure if it because the unicode spec changes?
http://www.unicode.org/reports/tr51/
Test case
const emojiRegex = require('emoji-regex');
const emojis = '๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ค,๐ฅ,๐จ,๐ฉ,๐ช,๐ซ,๐ญ,๐ฐ,๐ฑ,๐ฒ,๐ณ,๐ต,๐ท,๐ธ,๐น,๐บ,๐ป,๐ผ,๐ฝ,๐พ,๐ฟ,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,โ,โ
,โ,โ,โ,โ,โ,โ,โ,โ,โ,โจ,โณ,โด,โ,โ,โ,โ,โ,โ,โ,โ,โค,โ,โ,โ,โก,โฐ,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ข,๐ค,๐ฅ,๐ง,๐จ,๐ฉ,๐ช,๐ซ,๐ฌ,๐ญ,๐ฒ,๐ถ,๐น,๐บ,๐ป,๐ผ,๐ฝ,๐พ,๐,โ,๐
ฐ,๐
ฑ,๐
พ,๐
ฟ,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ฉ๐ช,๐ฌ๐ง,๐จ๐ณ,๐ฏ๐ต,๐ฐ๐ท,๐ซ๐ท,๐ช๐ธ,๐ฎ๐น,๐บ๐ธ,๐ท๐บ,๐,๐,๐,๐ฏ,๐ฒ,๐ณ,๐ด,๐ต,๐ถ,๐ท,๐ธ,๐น,๐บ,๐,๐,ยฉ,ยฎ,โผ,โ,8โฃ,9โฃ,7โฃ,6โฃ,1โฃ,0โฃ,2โฃ,3โฃ,5โฃ,4โฃ,#โฃ,โข,โน,โ,โ,โ,โ,โ,โ,โฉ,โช,โ,โ,โฉ,โช,โซ,โฌ,โฐ,โณ,โช,โซ,โถ,โ,โป,โผ,โฝ,โพ,โ,โ,โ,โ,โ,โ,โ,โบ,โ,โ,โ,โ,โ,โ,โ,โ,โ,โ,โ,โ,โ ,โฃ,โฅ,โฆ,โจ,โป,โฟ,โ,โ ,โก,โช,โซ,โฝ,โพ,โ,โ
,โ,โ,โช,โฒ,โณ,โต,โบ,โฝ,โคด,โคต,โฌ
,โฌ,โฌ,โฌ,โฌ,โญ,โญ,ใฐ,ใฝ,ใ,ใ,๐,๐,๐,๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ฐ,๐ฑ,๐ด,๐ต,๐ท,๐ธ,๐น,๐บ,๐ป,๐ผ,๐ฝ,๐พ,๐ฟ,๐,๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ค,๐ฅ,๐ฆ,๐ง,๐จ,๐ฉ,๐ช,๐ซ,๐ฌ,๐ญ,๐ฎ,๐ฏ,๐ฐ,๐ฑ,๐ฒ,๐ณ,๐ด,๐ต,๐ถ,๐ท,๐ธ,๐น,๐บ,๐ป,๐,๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ค,๐ฅ,๐ฆ,๐ง,๐จ,๐ฉ,๐ช,๐ซ,๐ฌ,๐ญ,๐ฎ,๐ฏ,๐ฐ,๐ฑ,๐ฒ,๐ณ,๐ด,๐ต,๐ถ,๐ท,๐ธ,๐น,๐บ,๐ป,๐ผ,๐ฝ,๐พ,๐ฟ,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ฅ,๐ฆ,๐ง,๐จ,๐ฉ,๐ช,๐ซ,๐ฌ,๐ญ,๐ฎ,๐ฏ,๐ฐ,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ค,๐ฅ,๐ฆ,๐ง,๐จ,๐ฉ,๐ซ,๐ฌ,๐ญ,๐ฎ,๐ฏ,๐ฐ,๐ฑ,๐ฒ,๐ณ,๐ด,๐ต,๐ถ,๐ท,๐ธ,๐น,๐บ,๐ป,๐ผ,๐ฝ,๐พ,๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ค,๐ฆ,๐ง,๐จ,๐ฉ,๐ช,๐ซ,๐ฎ,๐ฏ,๐ฐ,๐ฑ,๐ฒ,๐ณ,๐ด,๐ต,๐ถ,๐ท,๐ธ,๐น,๐บ,๐ป,๐ผ,๐ฝ,๐พ,๐ฟ,๐,๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ค,๐ฅ,๐ฆ,๐ง,๐จ,๐ฉ,๐ช,๐ซ,๐ฌ,๐ฎ,๐ฏ,๐ฐ,๐ฑ,๐ฒ,๐ณ,๐ด,๐ต,๐ธ,๐น,๐บ,๐ป,๐ผ,๐ฝ,๐พ,๐ฟ,๐,๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ค,๐ฅ,๐ฆ,๐ง,๐จ,๐ฉ,๐ช,๐ซ,๐ฎ,๐ฐ,๐ฑ,๐ฒ,๐ณ,๐ด,๐ถ,๐ท,๐น,๐บ,๐ป,๐ผ,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ค,๐ฅ,๐ฆ,๐ง,๐จ,๐ฉ,๐ช,๐ซ,๐ฎ,๐ฏ,๐ฐ,๐ฑ,๐ฒ,๐ณ,๐ด,๐ต,๐ถ,๐ท,๐ธ,๐น,๐บ,๐ป,๐ผ,๐ฝ,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ป,๐ผ,๐ฝ,๐พ,๐ฟ,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ฆ,๐ง,๐ฌ,๐ฎ,๐ฏ,๐ด,๐ถ,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ ,๐ก,๐ฃ,๐ฆ,๐ฎ,๐ฏ,๐ฐ,๐ฑ,๐ณ,๐ด,๐ต,๐ท,๐ธ,๐ฟ,๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ฒ,๐ณ,๐,๐,๐ผ,๐,๐,๐ค,๐,๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐,๐ช,๐ฅ,๐ฌ,๐ญ,๐ญ,๐ถ,๐ท,๐ฌ,๐ญ,๐ฏ,๐ต,๐,๐,๐,๐,๐
,๐,๐,๐,๐,๐ฌ,๐ญ,๐,๐,๐,๐,๐ ,๐ก,๐ข,๐ฃ,๐ค,๐ฅ,๐ฆ,๐ง'.split(',');
const exception = [];
emojis.forEach((emoji) => {
const match = emojiRegex().exec(emoji);
if (!match) { exception.push(emoji) }
});
console.log('Exception length', exception.length);
console.log(JSON.stringify(exception));
6.1.0
Exception length 0
[]
6.1.3
Exception length 72
["โ","โ","โ","โ","โ","โ","โ","โณ","โด","โ","โ","โค","โก","โ","๐
ฐ","๐
ฑ","๐
พ","๐
ฟ","๐","๐ท","ยฉ","ยฎ","โผ","โ","8โฃ","9โฃ","7โฃ","6โฃ","1โฃ","0โฃ","2โฃ","3โฃ","5โฃ","4โฃ","#โฃ","โข","โน","โ","โ","โ","โ","โ","โ","โฉ","โช","โช","โซ","โถ","โ","โป","โผ","โ","โ","โ","โ","โบ","โ ","โฃ","โฅ","โฆ","โจ","โป","โ ","โคด","โคต","โฌ
","โฌ","โฌ","ใฐ","ใฝ","ใ","ใ"]
Using https://github.com/Kikobeats/emojis-list as spec
6.1.0
Exception length 118
["๐ฆ","๐ง","๐จ","๐ฉ","๐ช","๐ซ","๐ฌ","๐ญ","๐ฎ","๐ฏ","๐ฐ","๐ฑ","๐ฒ","๐ณ","๐ด","๐ต","๐ถ","๐ท","๐ธ","๐น","๐บ๐ณ","๐บ","๐ป","๐ผ","๐ฝ","๐พ","๐ฟ","๐บ","๐ค","๐จ","๐","๐","๐ด","๐ต","๐ถ","๐ค","๐ค","๐ค","๐ค","๐ค","๐ค","๐ค ","๐คก","๐คข","๐คฃ","๐คค","๐คฅ","๐คฆโโ๏ธ","๐คฆโโ๏ธ","๐คฆ","๐คง","๐คฐ","๐คณ","๐คด","๐คต","๐คถ","๐คทโโ๏ธ","๐คทโโ๏ธ","๐คท","๐คธโโ๏ธ","๐คธโโ๏ธ","๐คธ","๐คนโโ๏ธ","๐คนโโ๏ธ","๐คน","๐คบ","๐คผโโ๏ธ","๐คผโโ๏ธ","๐คผ","๐คฝโโ๏ธ","๐คฝโโ๏ธ","๐คฝ","๐คพโโ๏ธ","๐คพโโ๏ธ","๐คพ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ
","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฅ","๐ฆ
","๐ฆ","๐ฆ","๐ฆ","๐ฆ","๐ฆ","๐ฆ","๐ฆ","๐ฆ","๐ฆ","๐ฆ","๐ฆ","๐ฆ","โ","โ","โ","๎"]
6.1.3
Exception length 209
["๐
ฐ","๐
ฑ","๐
พ","๐
ฟ","๐","๐ท","๐ก","๐ค","๐ฅ","๐ฆ","๐ง","๐จ","๐ฉ","๐ช","๐ซ","๐ฌ","๐ถ","๐ฝ","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐ณ","๐ต","๐ท","๐ฟ","๐โ๐จ","๐","๐ฝ","๐","๐","๐ฏ","๐ฐ","๐ณ","๐ถ","๐ท","๐ธ","๐น","๐","๐","๐","๐","๐","๐ฅ","๐จ","๐ฑ","๐ฒ","๐ผ","๐","๐","๐","๐","๐","๐","๐","๐","๐","๐ก","๐ฃ","๐จ","๐ฏ","๐ณ","๐บ","๐","๐","๐","๐","๐ ","๐ก","๐ข","๐ฃ","๐ค","๐ฅ","๐ฉ","๐ฐ","๐ณ","โผ","โ","โข","โน","โ","โ","โ","โ","โ","โ","โฉ","โช","#โฃ","โจ","โ","โญ","โฎ","โฏ","โฑ","โฒ","โธ","โน","โบ","โ","โช","โซ","โถ","โ","โป","โผ","โ","โ","โ","โ","โ","โ","โ","โ","โ ","โข","โฃ","โฆ","โช","โฎ","โฏ","โธ","โน","โบ","โ","โ","โ ","โฃ","โฅ","โฆ","โจ","โป","โ","โ","โ","โ","โ","โ","โ","โ","โ ","โฐ","โฑ","โ","โ","โ","โ","โฉ","โฐ","โฑ","โด","โท","โธ","โ","โ","โ","โ","โ","โ","โ","โ","โก","โณ","โด","โ","โ","โฃ","โค","โก","โคด","โคต","*โฃ","โฌ
","โฌ","โฌ","0โฃ","ใฐ","ใฝ","1โฃ","2โฃ","ใ","ใ","3โฃ","4โฃ","5โฃ","6โฃ","7โฃ","8โฃ","9โฃ","ยฉ","ยฎ","๎"]
Hi Mathias,
We are currently having a use case that will run through array to check if the item is emoji
const emojiRegex = require('emoji-regex');
const textList = ['๐', '๐', '๐' ,'๐', '๐
', '๐'];
const isEmoji = char => emojiRegex().text(char);
textList.forEach(char => every(isEmoji(char));
The global search state needs to be reset so we will need to call emojiRegex
every time instead of just create once like.
const emojiRegex = require('emoji-regex');
const REGEX = emojiRegex();
const textList = ['๐', '๐', '๐' ,'๐', '๐
', '๐'];
const isEmoji = char => REGEX.text(char);
textList.forEach(char => every(isEmoji(char));
probably really minor but there do have some perf difference if the use case is just to match single string.
https://jsperf.com/create-regex/1
Would like to hear about your idea and suggestion.
Thanks and Cheers!
hi,
is there any chance this project will support variations?
what we are using it for is to check if a text has emojis in it then wrap them with spans with the proper fonts so they work on more browsers properly (ie, edge)
because variations are not supported, it s considering them 2 characters with mixed results in various browsers (firefox sees it properly, chrome renders two characters)
cheers
๐
ฐ๏ธ๐
ฑ - \uD83C\uDD70\uFE0F\uD83C\uDD71\uFE0F
๐ - \uD83D\uDC41
Why?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.