mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-06-29 00:29:19 +02:00
Make validator more represents the JS script, commatization on spaces
Fun fact: The JS script also includes those that have no r/, but I made the validator warns it so future contributors can confirm and change it into a proper format, or delete it.
This commit is contained in:
parent
1406cc5b7a
commit
f4de2cbf7e
|
@ -18,7 +18,7 @@
|
|||
- [place.reddit.com](https://place.reddit.com)
|
||||
"""
|
||||
FS_REGEX = {
|
||||
"commatization": r'( *(,+ +|,+ |,+)| +)(and|&|;)( *(,+ +|,+ |,+)| +)|, *$',
|
||||
"commatization": r'( *(,+ +|,+ |,+)| +)(and|&|;)( *(,+ +|,+ |,+)| +)|, *$| +',
|
||||
"pattern1": r'\/*[rR]\/([A-Za-z0-9][A-Za-z0-9_]{1,20})(?:\/$)?',
|
||||
"pattern2": r'^\/*[rR](?!\/)([A-Za-z0-9][A-Za-z0-9_]{1,20})(?:\/$)?',
|
||||
"pattern3": r'(?:(?:https?:\/\/)?(?:(?:www|old|new|np)\.)?)?reddit\.com\/r\/([A-Za-z0-9][A-Za-z0-9_]{1,20})(?:\/[^" ]*)*',
|
||||
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
VALIDATE_REGEX = {
|
||||
"subreddit": r'^\/r\/([A-Za-z0-9][A-Za-z0-9_]{1,20})(, *\/r\/([A-Za-z0-9][A-Za-z0-9_]{1,20}))*$|^$',
|
||||
"subreddit": r'^ *\/?r\/([A-Za-z0-9][A-Za-z0-9_]{1,20}) *(, *\/?r\/([A-Za-z0-9][A-Za-z0-9_]{1,20}) *)*$|^$',
|
||||
"website": r'^https?://[^\s/$.?#].[^\s]*$|^$'
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue