fork download
  1. <?php
  2.  
  3. /* Result of the output of Joypixels Emoji-regex code.
  4.  *
  5.  * https://g...content-available-to-author-only...b.com/joypixels/emoji-regex/blob/master/src/php/index.php
  6.  */
  7.  
  8. $regex = [];
  9.  
  10. $regex['special'] = '' .
  11. # 1F3F3 FE0F 200D 1F308 ; rainbow flag AND (or) pirate flag
  12. '(?:' . '[\x{1F3F3}|\x{1F3F4}]' . '\x{FE0F}?' . '\x{200D}?' . '[\x{1F308}|\x{2620}]' . '\x{FE0F}?' . ')' . '|' .
  13. # 1F441 FE0F 200D 1F5E8 FE0F ; eye in speech bubble
  14. '(?:' . '\x{1F441}' . '\x{FE0F}?' . '\x{200D}?' . '\x{1F5E8}' . '\x{FE0F}?' . ')' . # Black Flag
  15. '';
  16.  
  17. $regex['flags'] = '(?:\x{1F3F4}[\x{E0060}-\x{E00FF}]{1,6})' . '|' . '[' . '\x{1F1E0}' . '-' . '\x{1F1FF}' . ']' . '{2}';
  18.  
  19. $regex['keycaps'] = '[\x{0023}-\x{0039}]' . '\x{FE0F}?' . '\x{20e3}';
  20.  
  21. $regex['peeps'] = '(?:[\x{1F466}-\x{1F469}]+' . '\x{FE0F}?' . '[\x{1F3FB}-\x{1F3FF}]?)';
  22.  
  23. /*$regex['gendered_roles_with_objects'] = '(?:' .
  24.   '[' . '\x{1F466}-\x{1F469}' . ']+' .
  25.   ')' .
  26.   '\x{FE0F}?' .
  27.   // skin tone modifiers
  28.   '[' . '\x{1F3FA}-\x{1F3FF}' . ']' . '?' .
  29.   '\x{200D}?' .
  30.   '(?:' .
  31.   '[' .
  32.   '\x{2695}' .
  33.   '\x{2696}' .
  34.   '\x{2708}' .
  35.   '\x{1F4BB}' .
  36.   '\x{1F4BC}' .
  37.   '\x{1F527}' .
  38.   '\x{1F52C}' .
  39.   '\x{1F680}' .
  40.   '\x{1F692}' .
  41.   '\x{1F33E}-\x{1F3ED}' .
  42.   ']' .
  43.   '\x{FE0F}?' .
  44.   ')';*/
  45.  
  46. $regex['gendered_roles_with_objects'] = '(?:[\x{1F468}|\x{1F469}]\x{FE0F}?[\x{1F3FB}-\x{1F3FF}]?\x{200D}?[\x{2695}|\x{2696}|\x{2708}|\x{1F4BB}|\x{1F4BC}|\x{1F527}|\x{1F52C}|\x{1F680}|\x{1F692}|\x{1F33E}|\x{1F3EB}|\x{1F3EC}|\x{1f373}|\x{1f393}|\x{1f3a4}|\x{1f3ed}|\x{1f3a8}]\x{FE0F}?)';
  47.  
  48. //print $regex['gendered_roles_with_objects'];
  49.  
  50. $regex['unicode_10'] = '[\x{1F468}-\x{1F469}\x{1F9D0}-\x{1F9DF}][\x{1F3FA}-\x{1F3FF}]?\x{200D}?[\x{2640}\x{2642}\x{2695}\x{2696}\x{2708}]?\x{FE0F}?';
  51.  
  52. $regex['unicode_11'] = '(?:[\x{1F9B5}|\x{1F9B6}]+[\x{1F3FB}-\x{1F3FF}]+)';
  53.  
  54. //the following replaces families
  55. $regex['couples_plus_kissing'] = '(?:[\x{1f468}|\x{1f469}]\x{200d}\x{2764}\x{fe0f}?\x{200d}[\x{1f48b}\x{200d}]*[\x{1f468}|\x{1f469}])';
  56. $regex['single_child_couples'] = '(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}])';
  57. $regex['two_child_couples'] = '(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}]\x{200d}[\x{1f466}|\x{1f467}])';
  58. $regex['single_child_person'] = '(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}])';
  59. $regex['two_child_person'] = '(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}]\x{200d}[\x{1f466}|\x{1f467}])';
  60.  
  61. //to work correctly, 'family' components must be placed in the following order
  62. $regex['families'] = $regex['couples_plus_kissing'] . '|' . $regex['two_child_couples'] . '|' . $regex['two_child_person'] . '|' . $regex['single_child_couples'] . '|' . $regex['single_child_person'];
  63.  
  64. //$regex['families'] = '(?:[\x{2764}\x{1F466}-\x{1F469}\x{1F48B}][\x{200D}\x{FE0F}]{0,2}){1,3}[\x{2764}\x{1F466}-\x{1F469}\x{1F48B}]|(?:[\x{2764}\x{1F466}-\x{1F469}\x{1F48B}]\x{FE0F}?){2,4}';
  65.  
  66. //removed {1,3} (replaced with a |) and removed {2,4} based on comment in this issue: https://g...content-available-to-author-only...b.com/emojione/emojione/issues/497
  67. // -this allowed for matching multiple red hearts (without space in between)
  68. //the following families formula was replaced in lieu of separated "family" components
  69. /*$regex['families'] = '(?:' .
  70.   '[\x{2764}\x{1F466}-\x{1F469}\x{1F48B}]' .
  71.   '[\x{200D}\x{FE0F}]{0,2}' .
  72.   ')' .
  73.   '|' .
  74.   '[\x{2764}\x{1F466}-\x{1F469}\x{1F48B}]' .
  75.   '|' .
  76.   '(?:' .
  77.   '[\x{2764}\x{1F466}-\x{1F469}\x{1F48B}]' .
  78.   '\x{FE0F}?' .
  79.   ')';*/
  80.  
  81. $regex['gendered_gestures'] = '(?:' .
  82. '[\x{1f46e}\x{1F468}\x{1F469}\x{1f575}\x{1f471}-\x{1f487}\x{1F645}-\x{1F64E}\x{1F926}\x{1F937}]' . '|' .
  83. '[\x{1F460}-\x{1F482}\x{1F3C3}-\x{1F3CC}\x{26F9}\x{1F486}\x{1F487}\x{1F6A3}-\x{1F6B6}\x{1F938}-\x{1F93E}]' . '|' .
  84. '\x{1F46F}' .
  85. ')' .
  86. '\x{FE0F}?' .
  87. '[\x{1F3FA}-\x{1F3FF}]?' .
  88. '\x{200D}?' .
  89. '[\x{2640}\x{2642}]?' .
  90. '\x{FE0F}?';
  91.  
  92. $regex['modifier_sequence'] = '(?:' .
  93. '[' .
  94. '\x{26F9}' . '\x{261D}' .
  95. '\x{270A}-\x{270D}' .
  96. '\x{1F385}-\x{1F3CC}' .
  97. '\x{1F442}-\x{1F4AA}' .
  98. '\x{1F574}-\x{1F596}' .
  99. '\x{1F645}-\x{1F64F}' .
  100. '\x{1F6A3}-\x{1F6CC}' .
  101. '\x{1F918}-\x{1F93E}' .
  102. ']' .
  103. '\x{FE0F}?' .
  104. // skin tone modifiers
  105. '[\x{1F3FA}-\x{1F3FF}]' .
  106. ')';
  107.  
  108. $regex['other'] = '(?:' .
  109. # Arrows (8 codepoints considered emoji),
  110. '[' . '\x{2194}-\x{2199}' . '\x{21a9}-\x{21aa}' . ']' . '\x{FE0F}?' . '|' .
  111. # Basic Latin (12)
  112. '[\x{0023}-\x{002a}]' . '|' .
  113. # CJK Symbols and Punctuation (2)
  114. '[\x{3030}\x{303d}]' . '\x{FE0F}?' . '|' .
  115. # Enclosed Alphanumeric Supplement (41)
  116. '(?:' .
  117. '[\x{1F170}-\x{1F171}]' . '|' .
  118. '[\x{1F17E}-\x{1F17F}]' . '|' .
  119. '\x{1F18E}' . '|' .
  120. '[\x{1F191}-\x{1F19A}]' . '|' .
  121. '[\x{1F1E6}-\x{1F1FF}]' .
  122. ')' . '\x{FE0F}?' . '|' .
  123. # Enclosed Alphanumerics (1),
  124. '\x{24c2}' . '\x{FE0F}?' . '|' .
  125. # Enclosed CJK Letters and Months (2)
  126. '[\x{3297}\x{3299}]' . '\x{FE0F}?' . '|' .
  127. # Enclosed Ideographic Supplement (15)
  128. '(?:' .
  129. '[\x{1F201}-\x{1F202}]' . '|' .
  130. '\x{1F21A}' . '|' .
  131. '\x{1F22F}' . '|' .
  132. '[\x{1F232}-\x{1F23A}]' . '|' .
  133. '[\x{1F250}-\x{1F251}]' .
  134. ')' . '\x{FE0F}?' . '|' .
  135. # General Punctuation (2)
  136. '[\x{203c}\x{2049}]' . '\x{FE0F}?' . '|' .
  137. # Geometric Shapes (8)
  138. '[' . '\x{25aa}-\x{25ab}' . '\x{25b6}\x{25c0}' . '\x{25fb}-\x{25fe}' . ']' .
  139. '\x{FE0F}?' . '|' .
  140. # Latin-1 Supplement (2)
  141. '[\x{00a9}\x{00ae}]' . '\x{FE0F}?' . '|' .
  142. # Letterlike Symbols (2)
  143. '[\x{2122}\x{2139}]' . '\x{FE0F}?' . '|' .
  144. # Mahjong Tiles (1)
  145. '\x{1F004}' . '\x{FE0F}?' . '|' .
  146. # Miscellaneous Symbols and Arrows (7)
  147. '[' . '\x{2b05}-\x{2b07}' . '\x{2b1b}-\x{2b1c}' . '\x{2b50}' . '\x{2b55}' . ']' .
  148. '\x{FE0F}?' . '|' .
  149. # Miscellaneous Technical (18)
  150. '[' .
  151. '\x{231a}-\x{231b}' .
  152. '\x{2328}' .
  153. '\x{23cf}' .
  154. '\x{23e9}-\x{23f3}' .
  155. '\x{23f8}-\x{23fa}' . ']' . '\x{FE0F}?' . '|' .
  156. # Playing Cards (1)
  157. '\x{1F0CF}' . '|' .
  158. # and Supplemental Arrows-B (2)
  159. '[\x{2934}\x{2935}]' . '\x{FE0F}?' .
  160. ')';
  161.  
  162. $regex['digits'] = '[\x{0030}-\x{0039}]\x{FE0F}';
  163. $regex['dingbats'] = '[\x{2700}-\x{27bf}]' . '\x{FE0F}?';
  164. $regex['emoticons'] = '[\x{1F000}-\x{1F6FF}\x{1F900}-\x{1F9FF}]' . '\x{FE0F}?';
  165. $regex['symbols'] = '[\x{2600}-\x{26ff}]' . '\x{FE0F}?';
  166.  
  167. $regex['superpeople'] = '(?:[\x{1F9B8}|\x{1F9B9}]+[\x{1F3FB}-\x{1F3FF}]?\x{200D}[\x{2640}-\x{2642}]?\x{FE0F}?)';
  168. $regex['hairstyles'] = '(?:[\x{1F468}|\x{1F469}]+[\x{1F3FB}-\x{1F3FF}]?\x{200D}[\x{1F9B0}-\x{1F9B3}]+\x{FE0F}?)';
  169.  
  170.  
  171. /*foreach ($regex AS $key => $val) {
  172.   print '# ' . $key . "\n" . $val . "\n\n\n";
  173. }*/
  174.  
  175. $regex = $regex['special'] . '|' .
  176. $regex['families'] . '|' .
  177. $regex['superpeople'] . '|' .
  178. $regex['hairstyles'] . '|' .
  179. $regex['keycaps'] . '|' .
  180. $regex['flags'] . '|' .
  181. $regex['gendered_roles_with_objects'] . '|' .
  182. $regex['unicode_10'] . '|' .
  183. $regex['unicode_11'] . '|' .
  184. $regex['gendered_gestures'] . '|' .
  185. $regex['modifier_sequence'] . '|' .
  186. $regex['other'] . '|' .
  187. $regex['dingbats'] . '|' .
  188. $regex['emoticons'] . '|' .
  189. $regex['symbols'] . '|' .
  190. $regex['peeps'] . '|' .
  191. $regex['digits'];
  192.  
  193. print $regex;
Success #stdin #stdout 0.02s 24356KB
stdin
Standard input is empty
stdout
(?:[\x{1F3F3}|\x{1F3F4}]\x{FE0F}?\x{200D}?[\x{1F308}|\x{2620}]\x{FE0F}?)|(?:\x{1F441}\x{FE0F}?\x{200D}?\x{1F5E8}\x{FE0F}?)|(?:[\x{1f468}|\x{1f469}]\x{200d}\x{2764}\x{fe0f}?\x{200d}[\x{1f48b}\x{200d}]*[\x{1f468}|\x{1f469}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1F9B8}|\x{1F9B9}]+[\x{1F3FB}-\x{1F3FF}]?\x{200D}[\x{2640}-\x{2642}]?\x{FE0F}?)|(?:[\x{1F468}|\x{1F469}]+[\x{1F3FB}-\x{1F3FF}]?\x{200D}[\x{1F9B0}-\x{1F9B3}]+\x{FE0F}?)|[\x{0023}-\x{0039}]\x{FE0F}?\x{20e3}|(?:\x{1F3F4}[\x{E0060}-\x{E00FF}]{1,6})|[\x{1F1E0}-\x{1F1FF}]{2}|(?:[\x{1F468}|\x{1F469}]\x{FE0F}?[\x{1F3FB}-\x{1F3FF}]?\x{200D}?[\x{2695}|\x{2696}|\x{2708}|\x{1F4BB}|\x{1F4BC}|\x{1F527}|\x{1F52C}|\x{1F680}|\x{1F692}|\x{1F33E}|\x{1F3EB}|\x{1F3EC}|\x{1f373}|\x{1f393}|\x{1f3a4}|\x{1f3ed}|\x{1f3a8}]\x{FE0F}?)|[\x{1F468}-\x{1F469}\x{1F9D0}-\x{1F9DF}][\x{1F3FA}-\x{1F3FF}]?\x{200D}?[\x{2640}\x{2642}\x{2695}\x{2696}\x{2708}]?\x{FE0F}?|(?:[\x{1F9B5}|\x{1F9B6}]+[\x{1F3FB}-\x{1F3FF}]+)|(?:[\x{1f46e}\x{1F468}\x{1F469}\x{1f575}\x{1f471}-\x{1f487}\x{1F645}-\x{1F64E}\x{1F926}\x{1F937}]|[\x{1F460}-\x{1F482}\x{1F3C3}-\x{1F3CC}\x{26F9}\x{1F486}\x{1F487}\x{1F6A3}-\x{1F6B6}\x{1F938}-\x{1F93E}]|\x{1F46F})\x{FE0F}?[\x{1F3FA}-\x{1F3FF}]?\x{200D}?[\x{2640}\x{2642}]?\x{FE0F}?|(?:[\x{26F9}\x{261D}\x{270A}-\x{270D}\x{1F385}-\x{1F3CC}\x{1F442}-\x{1F4AA}\x{1F574}-\x{1F596}\x{1F645}-\x{1F64F}\x{1F6A3}-\x{1F6CC}\x{1F918}-\x{1F93E}]\x{FE0F}?[\x{1F3FA}-\x{1F3FF}])|(?:[\x{2194}-\x{2199}\x{21a9}-\x{21aa}]\x{FE0F}?|[\x{0023}-\x{002a}]|[\x{3030}\x{303d}]\x{FE0F}?|(?:[\x{1F170}-\x{1F171}]|[\x{1F17E}-\x{1F17F}]|\x{1F18E}|[\x{1F191}-\x{1F19A}]|[\x{1F1E6}-\x{1F1FF}])\x{FE0F}?|\x{24c2}\x{FE0F}?|[\x{3297}\x{3299}]\x{FE0F}?|(?:[\x{1F201}-\x{1F202}]|\x{1F21A}|\x{1F22F}|[\x{1F232}-\x{1F23A}]|[\x{1F250}-\x{1F251}])\x{FE0F}?|[\x{203c}\x{2049}]\x{FE0F}?|[\x{25aa}-\x{25ab}\x{25b6}\x{25c0}\x{25fb}-\x{25fe}]\x{FE0F}?|[\x{00a9}\x{00ae}]\x{FE0F}?|[\x{2122}\x{2139}]\x{FE0F}?|\x{1F004}\x{FE0F}?|[\x{2b05}-\x{2b07}\x{2b1b}-\x{2b1c}\x{2b50}\x{2b55}]\x{FE0F}?|[\x{231a}-\x{231b}\x{2328}\x{23cf}\x{23e9}-\x{23f3}\x{23f8}-\x{23fa}]\x{FE0F}?|\x{1F0CF}|[\x{2934}\x{2935}]\x{FE0F}?)|[\x{2700}-\x{27bf}]\x{FE0F}?|[\x{1F000}-\x{1F6FF}\x{1F900}-\x{1F9FF}]\x{FE0F}?|[\x{2600}-\x{26ff}]\x{FE0F}?|(?:[\x{1F466}-\x{1F469}]+\x{FE0F}?[\x{1F3FB}-\x{1F3FF}]?)|[\x{0030}-\x{0039}]\x{FE0F}