Skip to content

Commit

Permalink
Regex refactor: Improve non-emoji keycaps
Browse files Browse the repository at this point in the history
  • Loading branch information
janlelis committed Oct 20, 2024
1 parent e551fda commit 1bedba9
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 9 deletions.
10 changes: 9 additions & 1 deletion data/generate_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def compile(emoji_character:, emoji_modifier:, emoji_modifier_base:, emoji_compo
"(?!" + emoji_component + ")" + emoji_presentation_sequence

text_keycap_sequence = \
join(EMOJI_KEYCAPS.map{|keycap| pack([keycap, EMOJI_KEYCAP_SUFFIX]) })
pack_and_join(EMOJI_KEYCAPS) + pack(EMOJI_KEYCAP_SUFFIX)

text_presentation_sequence = \
join(
Expand Down Expand Up @@ -154,6 +154,14 @@ def compile(emoji_character:, emoji_modifier:, emoji_modifier_base:, emoji_compo
emoji_core_sequence,
)

# emoji_rgi_mqe_sequence = \
# join(
# emoji_rgi_zwj_sequence,
# emoji_rgi_tag_sequence,
# emoji_valid_flag_sequence,
# emoji_core_sequence,
# )

emoji_valid_sequence = \
join(
emoji_valid_zwj_sequence,
Expand Down
2 changes: 1 addition & 1 deletion lib/unicode/emoji/generated/regex_include_text.rb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/unicode/emoji/generated/regex_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

module Unicode
module Emoji
REGEX_TEXT = /(?:(?![\#\*0-9‍⃣️🇦-🇿🏻-🏿🦰-🦳󠀠-󠁿])(?:[\#\*0-9©®‼⁉™ℹ↔-↙↩↪⌨⏏⏭-⏯⏱⏲⏸-⏺Ⓜ▪▫▶◀◻◼☀-☄☎☑☘☝☠☢☣☦☪☮☯☸-☺♀♂♟♠♣♥♦♨♻♾⚒⚔-⚗⚙⚛⚜⚠⚧⚰⚱⛈⛏⛑⛓⛩⛰⛱⛴⛷-⛹✂✈✉✌✍✏✒✔✖✝✡✳✴❄❇❣❤➡⤴⤵⬅-⬇〰〽㊗㊙🅰🅱🅾🅿🈂🈷🌡🌤-🌬🌶🍽🎖🎗🎙-🎛🎞🎟🏋-🏎🏔-🏟🏳🏵🏷🐿👁📽🕉🕊🕯🕰🕳-🕹🖇🖊-🖍🖐🖥🖨🖱🖲🖼🗂-🗄🗑-🗓🗜-🗞🗡🗣🗨🗯🗳🗺🛋🛍-🛏🛠-🛥🛩🛰🛳](?!(?:[🏻-🏿]|️))︎?|[⌚⌛⏩-⏬⏰⏳◽◾☔☕♈-♓♿⚓⚡⚪⚫⚽⚾⛄⛅⛎⛔⛪⛲⛳⛵⛺⛽✅✊✋✨❌❎❓-❕❗➕-➗➰➿⬛⬜⭐⭕🀄🃏🆎🆑-🆚🇦-🇿🈁🈚🈯🈲-🈶🈸-🈺🉐🉑🌀-🌠🌭-🌵🌷-🍼🍾-🎓🎠-🏊🏏-🏓🏠-🏰🏴🏸-🐾👀👂-📼📿-🔽🕋-🕎🕐-🕧🕺🖕🖖🖤🗻-🙏🚀-🛅🛌🛐-🛒🛕-🛗🛜-🛟🛫🛬🛴-🛼🟠-🟫🟰🤌-🤺🤼-🥅🥇-🧿🩰-🩼🪀-🪉🪏-🫆🫎-🫜🫟-🫩🫰-🫸]︎)|(?:\#⃣|\*⃣|0⃣|1⃣|2⃣|3⃣|4⃣|5⃣|6⃣|7⃣|8⃣|9⃣))/
REGEX_TEXT = /(?:(?![\#\*0-9‍⃣️🇦-🇿🏻-🏿🦰-🦳󠀠-󠁿])(?:[\#\*0-9©®‼⁉™ℹ↔-↙↩↪⌨⏏⏭-⏯⏱⏲⏸-⏺Ⓜ▪▫▶◀◻◼☀-☄☎☑☘☝☠☢☣☦☪☮☯☸-☺♀♂♟♠♣♥♦♨♻♾⚒⚔-⚗⚙⚛⚜⚠⚧⚰⚱⛈⛏⛑⛓⛩⛰⛱⛴⛷-⛹✂✈✉✌✍✏✒✔✖✝✡✳✴❄❇❣❤➡⤴⤵⬅-⬇〰〽㊗㊙🅰🅱🅾🅿🈂🈷🌡🌤-🌬🌶🍽🎖🎗🎙-🎛🎞🎟🏋-🏎🏔-🏟🏳🏵🏷🐿👁📽🕉🕊🕯🕰🕳-🕹🖇🖊-🖍🖐🖥🖨🖱🖲🖼🗂-🗄🗑-🗓🗜-🗞🗡🗣🗨🗯🗳🗺🛋🛍-🛏🛠-🛥🛩🛰🛳](?!(?:[🏻-🏿]|️))︎?|[⌚⌛⏩-⏬⏰⏳◽◾☔☕♈-♓♿⚓⚡⚪⚫⚽⚾⛄⛅⛎⛔⛪⛲⛳⛵⛺⛽✅✊✋✨❌❎❓-❕❗➕-➗➰➿⬛⬜⭐⭕🀄🃏🆎🆑-🆚🇦-🇿🈁🈚🈯🈲-🈶🈸-🈺🉐🉑🌀-🌠🌭-🌵🌷-🍼🍾-🎓🎠-🏊🏏-🏓🏠-🏰🏴🏸-🐾👀👂-📼📿-🔽🕋-🕎🕐-🕧🕺🖕🖖🖤🗻-🙏🚀-🛅🛌🛐-🛒🛕-🛗🛜-🛟🛫🛬🛴-🛼🟠-🟫🟰🤌-🤺🤼-🥅🥇-🧿🩰-🩼🪀-🪉🪏-🫆🫎-🫜🫟-🫩🫰-🫸]︎)|[\#\*0-9]⃣)/
end
end
2 changes: 1 addition & 1 deletion lib/unicode/emoji/generated/regex_valid_include_text.rb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/unicode/emoji/generated_native/regex_include_text.rb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/unicode/emoji/generated_native/regex_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

module Unicode
module Emoji
REGEX_TEXT = /(?:(?!\p{EComp})(?:\p{Emoji}(?<!\p{EPres})(?!(?:\p{EMod}|️))︎?|\p{EPres}︎)|(?:\#⃣|\*⃣|0⃣|1⃣|2⃣|3⃣|4⃣|5⃣|6⃣|7⃣|8⃣|9⃣))/
REGEX_TEXT = /(?:(?!\p{EComp})(?:\p{Emoji}(?<!\p{EPres})(?!(?:\p{EMod}|️))︎?|\p{EPres}︎)|[\#\*0-9]⃣)/
end
end

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

module Unicode
module Emoji
REGEX_WELL_FORMED_INCLUDE_TEXT = /(?-mix:(?:(?:(?:\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}(?!︎)️?)))|(?-mix:(?!\p{EComp})(?:\p{Emoji}(?<!\p{EPres})(?!(?:\p{EMod}|️))︎?|\p{EPres}︎)|(?:\#⃣|\*⃣|0⃣|1⃣|2⃣|3⃣|4⃣|5⃣|6⃣|7⃣|8⃣|9⃣))/
REGEX_WELL_FORMED_INCLUDE_TEXT = /(?-mix:(?:(?:(?:\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}(?!︎)️?)))|(?-mix:(?!\p{EComp})(?:\p{Emoji}(?<!\p{EPres})(?!(?:\p{EMod}|️))︎?|\p{EPres}︎)|[\#\*0-9]⃣)/
end
end

0 comments on commit 1bedba9

Please sign in to comment.