61
63
_email_re = lazy_regex.lazy_compile(r'([a-z0-9_\-.+]+@[a-z0-9_\-.+]+)', re.IGNORECASE)
62
64
_link1_re = lazy_regex.lazy_compile(r'([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])', re.IGNORECASE)
63
65
_link2_re = lazy_regex.lazy_compile(r'(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^ <>{}()\n\r]*[^., <>{}()\n\r]?)?)', re.IGNORECASE)
64
66
_tag_re = lazy_regex.lazy_compile(r'[, ]')
65
67
_start_of_line_whitespace_re = lazy_regex.lazy_compile(r'(?m)^ +')
69
72
text = _start_of_line_whitespace_re.sub(lambda m: " " * len(m.group()), text)