Skip to content

Commit 7d71c4a

Browse files
authored
fix regex_check (#96)
1 parent ff7adad commit 7d71c4a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

app/core/models.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
from django.forms import ValidationError
77
from django.urls import reverse
88

9-
regex_check = (r'(?!(\A( \x09\x0A\x0D\x20-\x7E # ASCII '
10-
r'| \xC2-\xDF # non-overlong 2-byte '
11-
r'| \xE0\xA0-\xBF # excluding overlongs '
12-
r'| \xE1-\xEC\xEE\xEF{2} # straight 3-byte '
13-
r'| \xED\x80-\x9F # excluding surrogates '
14-
r'| \xF0\x90-\xBF{2} # planes 1-3 '
15-
r'| \xF1-\xF3{3} # planes 4-15 '
16-
r'| \xF4\x80-\x8F{2} # plane 16 )*\Z))')
9+
regex_check = (
10+
r'^(' # start at start
11+
r'[\x09\x0A\x0D\x20-\x7E]' # ASCII
12+
r'|[\xC2-\xDF]' # non-overlong 2-byte
13+
r'|[\xE0\xA0-\xBF]' # excluding overlongs
14+
r'|[\xE1-\xEC\xEE\xEF]{2}' # straight 3-byte
15+
r'|[\xED\x80-\x9F]' # excluding surrogates
16+
r'|[\xF0\x90-\xBF]{2}' # planes 1-3
17+
r'|[\xF1-\xF3]{3}' # planes 4-15
18+
r'|[\xF4\x80-\x8F]{2}' # plane 16
19+
r')*$') # match all until end
1720

1821

1922
class XISConfiguration(models.Model):

0 commit comments

Comments
 (0)