Character classes and Unicode characters



examples/regex/character_class_unicode.py

import re

text = "๐Ÿ‘ท๐Ÿ‘ธ๐Ÿ‘น๐Ÿ‘บ๐Ÿ‘ปโœ๐Ÿ‘ผ๐Ÿ‘ฝ๐Ÿ‘พ๐Ÿ‘ฟ๐Ÿ’€๐Ÿ’๐Ÿ’‚"

print(text)
#print(chr(128120))
#print(0x1f000)

match = re.search(r"[\U0001f000-\U00020000]+", text)
if match:
    print(match.group(0))

for emoji in text:
    print(emoji, ord(emoji), "{:x}".format(ord(emoji)))

match = re.search(r"[๐Ÿ‘ท-๐Ÿ’‚]*", text)
print(match.group(0))