File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 20
20
from __future__ import unicode_literals
21
21
22
22
import re
23
+ import sys
23
24
try :
24
25
from urllib .parse import quote # Python3
25
26
except ImportError :
26
27
from urllib import quote
27
28
28
29
__version__ = "1.0.3.0"
29
30
30
- # Some of this code has been translated from the twitter-text-java library:
31
- # <http://github.com/mzsanford/twitter-text-java>
32
31
AT_SIGNS = r'[@\uff20]'
33
32
UTF_CHARS = r'a-z0-9_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff'
34
33
SPACES = r'[\u0020\u00A0\u1680\u180E\u2002-\u202F\u205F\u2060\u3000]'
40
39
re .IGNORECASE )
41
40
42
41
# Users
43
- USERNAME_REGEX = re .compile (r'\B' + AT_SIGNS + LIST_END_CHARS , re .IGNORECASE )
42
+ if sys .version_info >= (3 , 0 ):
43
+ username_flags = re .ASCII | re .IGNORECASE
44
+ else :
45
+ username_flags = re .IGNORECASE
46
+ USERNAME_REGEX = re .compile (r'\B' + AT_SIGNS + LIST_END_CHARS , username_flags )
44
47
REPLY_REGEX = re .compile (r'^(?:' + SPACES + r')*' + AT_SIGNS
45
48
+ r'([a-z0-9_]{1,20}).*' , re .IGNORECASE )
46
49
You can’t perform that action at this time.
0 commit comments