Created
December 17, 2019 07:17
-
-
Save z00sts/a72066e83abebd605198654c31938ccc to your computer and use it in GitHub Desktop.
regex_verbose.py
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
_options_regex = re.compile( | |
r''' | |
(?P<keyword>[\w.-]+) # Consist of 1+ alphanumeric or '.' or '-' | |
\s* | |
(?P<settings> # Settings are optional | |
: # "Keyword/settings" delimiter | |
\s* | |
(?P<quote>"?) # Optional quote character | |
(?P<value> | |
( | |
( | |
(\\") | |
| | |
(\\;) | |
| | |
. | |
)+? | |
) | |
) # Value is a non greedy match | |
(?P=quote) # Matched quote character for the first one | |
)? | |
\s* | |
($|;) # Entry ends with ; or end of string | |
\s* # Spaces | |
''', | |
re.VERBOSE | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment