unicode-emoji 3.8.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rake_tasks +1 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +3 -3
- data/README.md +30 -20
- data/data/generate_constants.rb +31 -8
- data/lib/unicode/emoji/constants.rb +6 -2
- data/lib/unicode/emoji/generated/regex.rb +1 -1
- data/lib/unicode/emoji/generated/regex_basic.rb +1 -1
- data/lib/unicode/emoji/generated/regex_emoji_keycap.rb +8 -0
- data/lib/unicode/emoji/generated/regex_include_mqe.rb +1 -1
- data/lib/unicode/emoji/generated/regex_include_mqe_uqe.rb +1 -1
- data/lib/unicode/emoji/generated/regex_include_text.rb +1 -1
- data/lib/unicode/emoji/generated/regex_prop_component.rb +8 -0
- data/lib/unicode/emoji/generated/regex_prop_emoji.rb +8 -0
- data/lib/unicode/emoji/generated/regex_prop_modifier.rb +8 -0
- data/lib/unicode/emoji/generated/regex_prop_modifier_base.rb +8 -0
- data/lib/unicode/emoji/generated/regex_prop_presentation.rb +8 -0
- data/lib/unicode/emoji/generated/regex_valid.rb +1 -1
- data/lib/unicode/emoji/generated/regex_valid_include_text.rb +1 -1
- data/lib/unicode/emoji/generated/regex_well_formed.rb +1 -1
- data/lib/unicode/emoji/generated/regex_well_formed_include_text.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_basic.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_emoji_keycap.rb +8 -0
- data/lib/unicode/emoji/generated_native/regex_include_mqe.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_include_mqe_uqe.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_include_text.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_picto_no_emoji.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_prop_component.rb +8 -0
- data/lib/unicode/emoji/generated_native/{regex_any.rb → regex_prop_emoji.rb} +1 -1
- data/lib/unicode/emoji/generated_native/regex_prop_modifier.rb +8 -0
- data/lib/unicode/emoji/generated_native/regex_prop_modifier_base.rb +8 -0
- data/lib/unicode/emoji/generated_native/regex_prop_presentation.rb +8 -0
- data/lib/unicode/emoji/generated_native/regex_text.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_valid.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_valid_include_text.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_well_formed.rb +1 -1
- data/lib/unicode/emoji/generated_native/regex_well_formed_include_text.rb +1 -1
- data/lib/unicode/emoji.rb +8 -2
- data/spec/unicode_emoji_spec.rb +97 -16
- metadata +14 -4
- data/lib/unicode/emoji/generated/regex_any.rb +0 -8
@@ -3,6 +3,6 @@
|
|
3
3
|
|
4
4
|
module Unicode
|
5
5
|
module Emoji
|
6
|
-
REGEX_VALID_INCLUDE_TEXT = /(?:(?:(?:(?:\p{EBase}\p{EMod}|(?:\p{Emoji}(?<!\p{EPres})️|\p{EPres}(?!︎)️?)|\p{Emoji}))+(?:\p{EBase}\p{EMod}|(?:\p{Emoji}(?<!\p{EPres})️|\p{EPres}(?!︎)️?)|\p{Emoji}))|(?:🏴(?:[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-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]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||))|(?:🇦🇨|🇦🇩|🇦🇪|🇦🇫|🇦🇬|🇦🇮|🇦🇱|🇦🇲|🇦🇴|🇦🇶|🇦🇷|🇦🇸|🇦🇹|🇦🇺|🇦🇼|🇦🇽|🇦🇿|🇧🇦|🇧🇧|🇧🇩|🇧🇪|🇧🇫|🇧🇬|🇧🇭|🇧🇮|🇧🇯|🇧🇱|🇧🇲|🇧🇳|🇧🇴|🇧🇶|🇧🇷|🇧🇸|🇧🇹|🇧🇻|🇧🇼|🇧🇾|🇧🇿|🇨🇦|🇨🇨|🇨🇩|🇨🇫|🇨🇬|🇨🇭|🇨🇮|🇨🇰|🇨🇱|🇨🇲|🇨🇳|🇨🇴|🇨🇵|🇨🇶|🇨🇷|🇨🇺|🇨🇻|🇨🇼|🇨🇽|🇨🇾|🇨🇿|🇩🇪|🇩🇬|🇩🇯|🇩🇰|🇩🇲|🇩🇴|🇩🇿|🇪🇦|🇪🇨|🇪🇪|🇪🇬|🇪🇭|🇪🇷|🇪🇸|🇪🇹|🇪🇺|🇫🇮|🇫🇯|🇫🇰|🇫🇲|🇫🇴|🇫🇷|🇬🇦|🇬🇧|🇬🇩|🇬🇪|🇬🇫|🇬🇬|🇬🇭|🇬🇮|🇬🇱|🇬🇲|🇬🇳|🇬🇵|🇬🇶|🇬🇷|🇬🇸|🇬🇹|🇬🇺|🇬🇼|🇬🇾|🇭🇰|🇭🇲|🇭🇳|🇭🇷|🇭🇹|🇭🇺|🇮🇨|🇮🇩|🇮🇪|🇮🇱|🇮🇲|🇮🇳|🇮🇴|🇮🇶|🇮🇷|🇮🇸|🇮🇹|🇯🇪|🇯🇲|🇯🇴|🇯🇵|🇰🇪|🇰🇬|🇰🇭|🇰🇮|🇰🇲|🇰🇳|🇰🇵|🇰🇷|🇰🇼|🇰🇾|🇰🇿|🇱🇦|🇱🇧|🇱🇨|🇱🇮|🇱🇰|🇱🇷|🇱🇸|🇱🇹|🇱🇺|🇱🇻|🇱🇾|🇲🇦|🇲🇨|🇲🇩|🇲🇪|🇲🇫|🇲🇬|🇲🇭|🇲🇰|🇲🇱|🇲🇲|🇲🇳|🇲🇴|🇲🇵|🇲🇶|🇲🇷|🇲🇸|🇲🇹|🇲🇺|🇲🇻|🇲🇼|🇲🇽|🇲🇾|🇲🇿|🇳🇦|🇳🇨|🇳🇪|🇳🇫|🇳🇬|🇳🇮|🇳🇱|🇳🇴|🇳🇵|🇳🇷|🇳🇺|🇳🇿|🇴🇲|🇵🇦|🇵🇪|🇵🇫|🇵🇬|🇵🇭|🇵🇰|🇵🇱|🇵🇲|🇵🇳|🇵🇷|🇵🇸|🇵🇹|🇵🇼|🇵🇾|🇶🇦|🇷🇪|🇷🇴|🇷🇸|🇷🇺|🇷🇼|🇸🇦|🇸🇧|🇸🇨|🇸🇩|🇸🇪|🇸🇬|🇸🇭|🇸🇮|🇸🇯|🇸🇰|🇸🇱|🇸🇲|🇸🇳|🇸🇴|🇸🇷|🇸🇸|🇸🇹|🇸🇻|🇸🇽|🇸🇾|🇸🇿|🇹🇦|🇹🇨|🇹🇩|🇹🇫|🇹🇬|🇹🇭|🇹🇯|🇹🇰|🇹🇱|🇹🇲|🇹🇳|🇹🇴|🇹🇷|🇹🇹|🇹🇻|🇹🇼|🇹🇿|🇺🇦|🇺🇬|🇺🇲|🇺🇳|🇺🇸|🇺🇾|🇺🇿|🇻🇦|🇻🇨|🇻🇪|🇻🇬|🇻🇮|🇻🇳|🇻🇺|🇼🇫|🇼🇸|🇽🇰|🇾🇪|🇾🇹|🇿🇦|🇿🇲|🇿🇼)|(?:[\#\*0-9]️⃣|\p{EBase}\p{EMod}|(?!\p{EComp})(?:\p{Emoji}(?<!\p{EPres})️|\p{EPres}(?!︎)️?))|(?:(?!\p{EComp})(?:\p{Emoji}(?<!\p{EPres})(?!(?:\p{EMod}|️))︎?|\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-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|[-]|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||))|(?:🇦🇨|🇦🇩|🇦🇪|🇦🇫|🇦🇬|🇦🇮|🇦🇱|🇦🇲|🇦🇴|🇦🇶|🇦🇷|🇦🇸|🇦🇹|🇦🇺|🇦🇼|🇦🇽|🇦🇿|🇧🇦|🇧🇧|🇧🇩|🇧🇪|🇧🇫|🇧🇬|🇧🇭|🇧🇮|🇧🇯|🇧🇱|🇧🇲|🇧🇳|🇧🇴|🇧🇶|🇧🇷|🇧🇸|🇧🇹|🇧🇻|🇧🇼|🇧🇾|🇧🇿|🇨🇦|🇨🇨|🇨🇩|🇨🇫|🇨🇬|🇨🇭|🇨🇮|🇨🇰|🇨🇱|🇨🇲|🇨🇳|🇨🇴|🇨🇵|🇨🇶|🇨🇷|🇨🇺|🇨🇻|🇨🇼|🇨🇽|🇨🇾|🇨🇿|🇩🇪|🇩🇬|🇩🇯|🇩🇰|🇩🇲|🇩🇴|🇩🇿|🇪🇦|🇪🇨|🇪🇪|🇪🇬|🇪🇭|🇪🇷|🇪🇸|🇪🇹|🇪🇺|🇫🇮|🇫🇯|🇫🇰|🇫🇲|🇫🇴|🇫🇷|🇬🇦|🇬🇧|🇬🇩|🇬🇪|🇬🇫|🇬🇬|🇬🇭|🇬🇮|🇬🇱|🇬🇲|🇬🇳|🇬🇵|🇬🇶|🇬🇷|🇬🇸|🇬🇹|🇬🇺|🇬🇼|🇬🇾|🇭🇰|🇭🇲|🇭🇳|🇭🇷|🇭🇹|🇭🇺|🇮🇨|🇮🇩|🇮🇪|🇮🇱|🇮🇲|🇮🇳|🇮🇴|🇮🇶|🇮🇷|🇮🇸|🇮🇹|🇯🇪|🇯🇲|🇯🇴|🇯🇵|🇰🇪|🇰🇬|🇰🇭|🇰🇮|🇰🇲|🇰🇳|🇰🇵|🇰🇷|🇰🇼|🇰🇾|🇰🇿|🇱🇦|🇱🇧|🇱🇨|🇱🇮|🇱🇰|🇱🇷|🇱🇸|🇱🇹|🇱🇺|🇱🇻|🇱🇾|🇲🇦|🇲🇨|🇲🇩|🇲🇪|🇲🇫|🇲🇬|🇲🇭|🇲🇰|🇲🇱|🇲🇲|🇲🇳|🇲🇴|🇲🇵|🇲🇶|🇲🇷|🇲🇸|🇲🇹|🇲🇺|🇲🇻|🇲🇼|🇲🇽|🇲🇾|🇲🇿|🇳🇦|🇳🇨|🇳🇪|🇳🇫|🇳🇬|🇳🇮|🇳🇱|🇳🇴|🇳🇵|🇳🇷|🇳🇺|🇳🇿|🇴🇲|🇵🇦|🇵🇪|🇵🇫|🇵🇬|🇵🇭|🇵🇰|🇵🇱|🇵🇲|🇵🇳|🇵🇷|🇵🇸|🇵🇹|🇵🇼|🇵🇾|🇶🇦|🇷🇪|🇷🇴|🇷🇸|🇷🇺|🇷🇼|🇸🇦|🇸🇧|🇸🇨|🇸🇩|🇸🇪|🇸🇬|🇸🇭|🇸🇮|🇸🇯|🇸🇰|🇸🇱|🇸🇲|🇸🇳|🇸🇴|🇸🇷|🇸🇸|🇸🇹|🇸🇻|🇸🇽|🇸🇾|🇸🇿|🇹🇦|🇹🇨|🇹🇩|🇹🇫|🇹🇬|🇹🇭|🇹🇯|🇹🇰|🇹🇱|🇹🇲|🇹🇳|🇹🇴|🇹🇷|🇹🇹|🇹🇻|🇹🇼|🇹🇿|🇺🇦|🇺🇬|🇺🇲|🇺🇳|🇺🇸|🇺🇾|🇺🇿|🇻🇦|🇻🇨|🇻🇪|🇻🇬|🇻🇮|🇻🇳|🇻🇺|🇼🇫|🇼🇸|🇽🇰|🇾🇪|🇾🇹|🇿🇦|🇿🇲|🇿🇼)|(?:[\#\*0-9]️⃣|\p{EBase}\p{EMod}|(?!\p{EComp})(?:[\p{Emoji}&&\P{EPres}]️|\p{EPres}(?!︎)️?))|[🏻-🏿🦰-🦳]|(?:(?!\p{EComp})(?:[\p{Emoji}&&\P{EPres}](?!(?:\p{EMod}|️))︎?|\p{EPres}︎)|[\#\*0-9]⃣))/
|
7
7
|
end
|
8
8
|
end
|
@@ -3,6 +3,6 @@
|
|
3
3
|
|
4
4
|
module Unicode
|
5
5
|
module Emoji
|
6
|
-
REGEX_WELL_FORMED = /(?:(?:(?:(?:\p{EBase}\p{EMod}|(
|
6
|
+
REGEX_WELL_FORMED = /(?:(?:(?:(?:\p{EBase}\p{EMod}|(?:[\p{Emoji}&&\P{EPres}]️|\p{EPres}(?!︎)️?)|\p{Emoji}))+(?:\p{EBase}\p{EMod}|(?:[\p{Emoji}&&\P{EPres}]️|\p{EPres}(?!︎)️?)|\p{Emoji}))|(?:(?:(?!\p{EComp})(?:[\p{Emoji}&&\P{EPres}]️|\p{EPres}(?!︎)️?)|\p{EBase}\p{EMod})[--]{1,30})|\p{RI}{2}|(?:[\#\*0-9]️⃣|\p{EBase}\p{EMod}|(?!\p{EComp})(?:[\p{Emoji}&&\P{EPres}]️|\p{EPres}(?!︎)️?))|[🏻-🏿🦰-🦳])/
|
7
7
|
end
|
8
8
|
end
|
@@ -3,6 +3,6 @@
|
|
3
3
|
|
4
4
|
module Unicode
|
5
5
|
module Emoji
|
6
|
-
REGEX_WELL_FORMED_INCLUDE_TEXT = /(?:(?:(?:(?:\p{EBase}\p{EMod}|(
|
6
|
+
REGEX_WELL_FORMED_INCLUDE_TEXT = /(?:(?:(?:(?:\p{EBase}\p{EMod}|(?:[\p{Emoji}&&\P{EPres}]️|\p{EPres}(?!︎)️?)|\p{Emoji}))+(?:\p{EBase}\p{EMod}|(?:[\p{Emoji}&&\P{EPres}]️|\p{EPres}(?!︎)️?)|\p{Emoji}))|(?:(?:(?!\p{EComp})(?:[\p{Emoji}&&\P{EPres}]️|\p{EPres}(?!︎)️?)|\p{EBase}\p{EMod})[--]{1,30})|\p{RI}{2}|(?:[\#\*0-9]️⃣|\p{EBase}\p{EMod}|(?!\p{EComp})(?:[\p{Emoji}&&\P{EPres}]️|\p{EPres}(?!︎)️?))|[🏻-🏿🦰-🦳]|(?:(?!\p{EComp})(?:[\p{Emoji}&&\P{EPres}](?!(?:\p{EMod}|️))︎?|\p{EPres}︎)|[\#\*0-9]⃣))/
|
7
7
|
end
|
8
8
|
end
|
data/lib/unicode/emoji.rb
CHANGED
@@ -17,7 +17,8 @@ module Unicode
|
|
17
17
|
EMOJI_MODIFIERS
|
18
18
|
EXTENDED_PICTOGRAPHIC
|
19
19
|
EXTENDED_PICTOGRAPHIC_NO_EMOJI
|
20
|
-
EMOJI_KEYCAPS
|
20
|
+
EMOJI_KEYCAPS
|
21
|
+
VALID_REGION_FLAGS
|
21
22
|
VALID_SUBDIVISIONS
|
22
23
|
RECOMMENDED_SUBDIVISION_FLAGS
|
23
24
|
RECOMMENDED_ZWJ_SEQUENCES
|
@@ -49,9 +50,14 @@ module Unicode
|
|
49
50
|
REGEX_POSSIBLE
|
50
51
|
REGEX_BASIC
|
51
52
|
REGEX_TEXT
|
53
|
+
REGEX_PROP_EMOJI
|
54
|
+
REGEX_PROP_MODIFIER
|
55
|
+
REGEX_PROP_MODIFIER_BASE
|
56
|
+
REGEX_PROP_COMPONENT
|
57
|
+
REGEX_PROP_PRESENTATION
|
52
58
|
REGEX_PICTO
|
53
59
|
REGEX_PICTO_NO_EMOJI
|
54
|
-
|
60
|
+
REGEX_EMOJI_KEYCAP
|
55
61
|
].each do |const_name|
|
56
62
|
autoload const_name, File.join(generated_constants_dirpath, const_name.downcase)
|
57
63
|
end
|
data/spec/unicode_emoji_spec.rb
CHANGED
@@ -39,8 +39,19 @@ describe Unicode::Emoji do
|
|
39
39
|
assert_equal "▶\u{FE0F}", $&
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
42
|
+
it "matches singleton skin tone modifiers and hair components" do
|
43
43
|
"🏻 light skin tone" =~ Unicode::Emoji::REGEX
|
44
|
+
assert_equal "🏻", $&
|
45
|
+
|
46
|
+
"🦰 emoji component red hair" =~ Unicode::Emoji::REGEX
|
47
|
+
assert_equal "🦰", $&
|
48
|
+
end
|
49
|
+
|
50
|
+
it "does not match singleton components that are not skin tone modifiers or hair components" do
|
51
|
+
"1 digit one" =~ Unicode::Emoji::REGEX
|
52
|
+
assert_nil $&
|
53
|
+
|
54
|
+
"🇦 regional indicator symbol letter a" =~ Unicode::Emoji::REGEX
|
44
55
|
assert_nil $&
|
45
56
|
end
|
46
57
|
|
@@ -94,12 +105,12 @@ describe Unicode::Emoji do
|
|
94
105
|
|
95
106
|
it "does not match MQE zwj sequences" do
|
96
107
|
"🤾🏽♀ woman playing handball: medium skin tone, missing VS16" =~ Unicode::Emoji::REGEX
|
97
|
-
refute_equal
|
108
|
+
refute_equal "🤾🏽♀", $&
|
98
109
|
end
|
99
110
|
|
100
111
|
it "does not match UQE emoji" do
|
101
112
|
"🏌♂️ man golfing, missing VS16" =~ Unicode::Emoji::REGEX
|
102
|
-
refute_equal
|
113
|
+
refute_equal "🏌♂️", $&
|
103
114
|
end
|
104
115
|
|
105
116
|
it "does not match valid zwj sequences that are not recommended" do
|
@@ -153,24 +164,24 @@ describe Unicode::Emoji do
|
|
153
164
|
describe "REGEX_INCLUDE_MQE" do
|
154
165
|
it "matches MQE emoji" do
|
155
166
|
"🤾🏽♀ woman playing handball: medium skin tone, missing VS16" =~ Unicode::Emoji::REGEX_INCLUDE_MQE
|
156
|
-
assert_equal
|
167
|
+
assert_equal "🤾🏽♀", $&
|
157
168
|
end
|
158
169
|
|
159
170
|
it "does not match UQE emoji" do
|
160
171
|
"🏌♂️ man golfing, missing VS16" =~ Unicode::Emoji::REGEX_INCLUDE_MQE
|
161
|
-
refute_equal
|
172
|
+
refute_equal "🏌♂️", $&
|
162
173
|
end
|
163
174
|
end
|
164
175
|
|
165
176
|
describe "REGEX_INCLUDE_MQE_UQE" do
|
166
177
|
it "matches MQE emoji" do
|
167
178
|
"🤾🏽♀ woman playing handball: medium skin tone, missing VS16" =~ Unicode::Emoji::REGEX_INCLUDE_MQE_UQE
|
168
|
-
assert_equal
|
179
|
+
assert_equal "🤾🏽♀", $&
|
169
180
|
end
|
170
181
|
|
171
182
|
it "matches UQE emoji" do
|
172
183
|
"🏌♂️ man golfing, missing VS16" =~ Unicode::Emoji::REGEX_INCLUDE_MQE_UQE
|
173
|
-
assert_equal
|
184
|
+
assert_equal "🏌♂️", $&
|
174
185
|
end
|
175
186
|
end
|
176
187
|
|
@@ -200,8 +211,19 @@ describe Unicode::Emoji do
|
|
200
211
|
assert_equal "▶\u{FE0F}", $&
|
201
212
|
end
|
202
213
|
|
203
|
-
it "
|
214
|
+
it "matches singleton skin tone modifiers and hair components" do
|
204
215
|
"🏻 light skin tone" =~ Unicode::Emoji::REGEX_VALID
|
216
|
+
assert_equal "🏻", $&
|
217
|
+
|
218
|
+
"🦰 emoji component red hair" =~ Unicode::Emoji::REGEX_VALID
|
219
|
+
assert_equal "🦰", $&
|
220
|
+
end
|
221
|
+
|
222
|
+
it "does not match singleton components that are not skin tone modifiers or hair components" do
|
223
|
+
"1 digit one" =~ Unicode::Emoji::REGEX_VALID
|
224
|
+
assert_nil $&
|
225
|
+
|
226
|
+
"🇦 regional indicator symbol letter a" =~ Unicode::Emoji::REGEX_VALID
|
205
227
|
assert_nil $&
|
206
228
|
end
|
207
229
|
|
@@ -295,8 +317,19 @@ describe Unicode::Emoji do
|
|
295
317
|
assert_equal "▶\u{FE0F}", $&
|
296
318
|
end
|
297
319
|
|
298
|
-
it "
|
320
|
+
it "matches singleton skin tone modifiers and hair components" do
|
299
321
|
"🏻 light skin tone" =~ Unicode::Emoji::REGEX_WELL_FORMED
|
322
|
+
assert_equal "🏻", $&
|
323
|
+
|
324
|
+
"🦰 emoji component red hair" =~ Unicode::Emoji::REGEX_WELL_FORMED
|
325
|
+
assert_equal "🦰", $&
|
326
|
+
end
|
327
|
+
|
328
|
+
it "does not match singleton components that are not skin tone modifiers or hair components" do
|
329
|
+
"1 digit one" =~ Unicode::Emoji::REGEX_WELL_FORMED
|
330
|
+
assert_nil $&
|
331
|
+
|
332
|
+
"🇦 regional indicator symbol letter a" =~ Unicode::Emoji::REGEX_WELL_FORMED
|
300
333
|
assert_nil $&
|
301
334
|
end
|
302
335
|
|
@@ -395,9 +428,20 @@ describe Unicode::Emoji do
|
|
395
428
|
assert_equal "▶\u{FE0F}", $&
|
396
429
|
end
|
397
430
|
|
398
|
-
it "matches singleton
|
431
|
+
it "matches singleton skin tone modifiers and hair components" do
|
399
432
|
"🏻 light skin tone" =~ Unicode::Emoji::REGEX_POSSIBLE
|
400
433
|
assert_equal "🏻", $&
|
434
|
+
|
435
|
+
"🦰 emoji component red hair" =~ Unicode::Emoji::REGEX_POSSIBLE
|
436
|
+
assert_equal "🦰", $&
|
437
|
+
end
|
438
|
+
|
439
|
+
it "matches singleton components that are not skin tone modifiers or hair components" do
|
440
|
+
"1 digit one" =~ Unicode::Emoji::REGEX_POSSIBLE
|
441
|
+
assert_equal "1", $&
|
442
|
+
|
443
|
+
"🇦 regional indicator symbol letter a" =~ Unicode::Emoji::REGEX_POSSIBLE
|
444
|
+
assert_equal "🇦", $&
|
401
445
|
end
|
402
446
|
|
403
447
|
it "matches modified emoji if modifier base emoji is used" do
|
@@ -486,17 +530,28 @@ describe Unicode::Emoji do
|
|
486
530
|
end
|
487
531
|
|
488
532
|
it "does not match textual singleton emoji" do
|
489
|
-
"▶ play button" =~ Unicode::Emoji::
|
533
|
+
"▶ play button" =~ Unicode::Emoji::REGEX_BASIC
|
490
534
|
assert_nil $&
|
491
535
|
end
|
492
536
|
|
493
537
|
it "matches textual singleton emoji in combination with emoji variation selector" do
|
494
|
-
"▶\u{FE0F} play button" =~ Unicode::Emoji::
|
538
|
+
"▶\u{FE0F} play button" =~ Unicode::Emoji::REGEX_BASIC
|
495
539
|
assert_equal "▶\u{FE0F}", $&
|
496
540
|
end
|
497
541
|
|
498
|
-
it "
|
542
|
+
it "matches singleton skin tone modifiers and hair components" do
|
499
543
|
"🏻 light skin tone" =~ Unicode::Emoji::REGEX_BASIC
|
544
|
+
assert_equal "🏻", $&
|
545
|
+
|
546
|
+
"🦰 emoji component red hair" =~ Unicode::Emoji::REGEX_BASIC
|
547
|
+
assert_equal "🦰", $&
|
548
|
+
end
|
549
|
+
|
550
|
+
it "does not match singleton components that are not skin tone modifiers or hair components" do
|
551
|
+
"1 digit one" =~ Unicode::Emoji::REGEX_BASIC
|
552
|
+
assert_nil $&
|
553
|
+
|
554
|
+
"🇦 regional indicator symbol letter a" =~ Unicode::Emoji::REGEX_BASIC
|
500
555
|
assert_nil $&
|
501
556
|
end
|
502
557
|
|
@@ -557,9 +612,20 @@ describe Unicode::Emoji do
|
|
557
612
|
assert_nil $&
|
558
613
|
end
|
559
614
|
|
560
|
-
it "does not match singleton
|
615
|
+
it "does not match singleton skin tone modifiers and hair components" do
|
561
616
|
"🏻 light skin tone" =~ Unicode::Emoji::REGEX_TEXT
|
562
617
|
assert_nil $&
|
618
|
+
|
619
|
+
"🦰 emoji component red hair" =~ Unicode::Emoji::REGEX_TEXT
|
620
|
+
assert_nil $&
|
621
|
+
end
|
622
|
+
|
623
|
+
it "does not match singleton components that are not skin tone modifiers or hair components" do
|
624
|
+
"1 digit one" =~ Unicode::Emoji::REGEX_TEXT
|
625
|
+
assert_nil $&
|
626
|
+
|
627
|
+
"🇦 regional indicator symbol letter a" =~ Unicode::Emoji::REGEX_TEXT
|
628
|
+
assert_nil $&
|
563
629
|
end
|
564
630
|
|
565
631
|
it "does not match modified emoji" do
|
@@ -596,13 +662,28 @@ describe Unicode::Emoji do
|
|
596
662
|
end
|
597
663
|
end
|
598
664
|
|
599
|
-
describe "
|
665
|
+
describe "REGEX_PROP_EMOJI" do
|
600
666
|
it "returns any emoji-related codepoint (but no variation selectors or tags)" do
|
601
|
-
matches = "1 string 😴\u{FE0F} sleeping face with 🇵 and modifier 🏾, also 🏴 Scotland".scan(Unicode::Emoji::
|
667
|
+
matches = "1 string 😴\u{FE0F} sleeping face with 🇵 and modifier 🏾, also 🏴 Scotland".scan(Unicode::Emoji::REGEX_PROP_EMOJI)
|
602
668
|
assert_equal ["1", "😴", "🇵", "🏾", "🏴"], matches
|
603
669
|
end
|
604
670
|
end
|
605
671
|
|
672
|
+
describe "REGEX_EMOJI_KEYCAP" do
|
673
|
+
it "matches emoji keycap sequences" do
|
674
|
+
"2️⃣ keycap: 2" =~ Unicode::Emoji::REGEX_EMOJI_KEYCAP
|
675
|
+
assert_equal "2️⃣", $&
|
676
|
+
end
|
677
|
+
|
678
|
+
it "does not match non-emoji keycap sequences" do
|
679
|
+
"8⃣ text keycap: 8" =~ Unicode::Emoji::REGEX_EMOJI_KEYCAP
|
680
|
+
assert_nil $&
|
681
|
+
|
682
|
+
"#⃣ text keycap: #" =~ Unicode::Emoji::REGEX_EMOJI_KEYCAP
|
683
|
+
assert_nil $&
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
606
687
|
describe "REGEX_PICTO" do
|
607
688
|
it "matches codepoints with Extended_Pictograph property (almost all emoji are, but also others)" do
|
608
689
|
matches = "U+1F32D 🌭 HOT DOG, U+203C ‼ DOUBLE EXCLAMATION MARK, U+26E8 ⛨ BLACK CROSS ON SHIELD".scan(Unicode::Emoji::REGEX_PICTO)
|