Last active
June 6, 2020 23:38
-
-
Save mals14/129427d5fb020f7ba4af4dfeabdb3f49 to your computer and use it in GitHub Desktop.
get date YYYY-MM-DD from string regular expression.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
def get_date_s_from_string(s): | |
"""extract YYYY-MM-DD from string formatted YYYY-MM-DD_... | |
Returns: | |
[type] -- [description] | |
""" | |
re_pattern = '\d{4}-\d{2}-\d{2}' | |
return re.search(re_pattern,s)[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment