def __init__(self, pattern):
# type: (Union[Text, regex._pattern_type, re._pattern_type]) -> None
"""
:param pattern:
String pattern, or pre-compiled regex.
IMPORTANT: If you specify your own compiled regex, be sure to
add the ``UNICODE`` flag for Unicode support!
"""
super(Regex, self).__init__()
self.regex = (
pattern
if isinstance(pattern, (regex._pattern_type, re._pattern_type))
else regex.compile(pattern, regex.UNICODE)
)
评论列表
文章目录