diff --git a/tools/formatter.py b/tools/formatter.py index 3f65e6fd..8c2833e1 100644 --- a/tools/formatter.py +++ b/tools/formatter.py @@ -21,7 +21,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_]{2,20})(?:\/$)?', "pattern2": r'^\/*[rR](?!\/)([A-Za-z0-9][A-Za-z0-9_]{2,20})(?:\/$)?', "pattern3": r'(?:(?:https?:\/\/)?(?:(?:www|old|new|np)\.)?)?reddit\.com\/r\/([A-Za-z0-9][A-Za-z0-9_]{2,20})(?:\/[^" ]*)*', diff --git a/tools/migrate_atlas_format.py b/tools/migrate_atlas_format.py index ffeaae7a..1aa088d1 100644 --- a/tools/migrate_atlas_format.py +++ b/tools/migrate_atlas_format.py @@ -15,7 +15,7 @@ EXPANSION_1_RANGE = (56, END_IMAGE) EXPANSION_2_RANGE = (109, END_IMAGE) -COMMATIZATION = re.compile(r'(?: *(?:,+ +|,+ |,+)| +)(?:and|&|;)(?: *(?:,+ +|,+ |,+)| +)|, *$| +') +COMMATIZATION = re.compile(r'[,;& ]+(?:and)?[,;& ]*?') FS_REGEX = re.compile(r'(?:(?:(?:(?:https?:\/\/)?(?:(?:www|old|new|np)\.)?)?reddit\.com)?\/)?[rR]\/([A-Za-z0-9][A-Za-z0-9_]{2,20})(?:\/[^" ]*)*') def migrate_atlas_format(entry: dict):