valid_password

PHOTO EMBED

Thu Mar 04 2021 08:34:49 GMT+0000 (Coordinated Universal Time)

Saved by @Bartok #python

"""
Our definition of a secure filename is:
- The filename must start with an English letters or a number (a-zA-Z0-9).
- The filename can **only** contain English letters, numbers and symbols among these four: `-_()`.
- The filename must end with a proper file extension among `.jpg`, `.jpeg`, `.png` and `.gif`
"""


def is_filename_safe(filename):
    # you only need to change the regular expression (regex) below
    regex = '^[a-zA-Z0-9][a-zA-Z0-9_()-]*(\.jpg|\.jpeg|\.png|\.gif)$'

    return re.match(regex, filename) is not None


content_copyCOPY