Created
February 17, 2020 11:21
-
-
Save no1xsyzy/53d83a7c29ce4e5d94296b52836b12d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
PATTERN = r"/|(/[^.][^/]*|/[^/][^./][^/]*|/\.\.[^/]+)+/?" | |
assert re.fullmatch(PATTERN, "/abc/") is not None | |
assert re.fullmatch(PATTERN, "/abc/../") is None | |
assert re.fullmatch(PATTERN, "/abc/./") is None | |
assert re.fullmatch(PATTERN, "/abc/.123/") is not None | |
assert re.fullmatch(PATTERN, "/abc/a.123/") is not None | |
assert re.fullmatch(PATTERN, "/abc/a./") is not None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment