Created
February 19, 2020 13:29
-
-
Save orangelynx/dc153862c97ee2340ff589c8afd77deb to your computer and use it in GitHub Desktop.
A really overkill regex expression (python) for parsing time deltas.
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
(?:(?P<years>\d+)\s*y(?:ears?)?)?\s*(?:(?P<months>\d+)\s*mon(?:ths?)?)?\s*(?:(?P<weeks>\d+)\s*w(?:eeks?)?)?\s*(?:(?P<days>\d+)\s*d(?:ays?)?)?\s*(?:(?P<hours>\d+)\s*h(?:(?:ou)?rs?)?)?\s*(?:(?P<minutes>\d+)\s*m(?:in(?:ute)?s?)?)?\s*(?:(?P<seconds>\d+)\s*s(?:ec(?:ond)?s?)?)?$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment