I'm implementing an application to process GPS data. In the application users can upload files and those files will be processed in server. I need to validate the user uploaded file extension. But the problem is extensions can be change. .17o, .11o, .12o, .13o, .14o, .15o, .23o, .54o common patterns are .*o, .*n, .*obs, .*nav, .nav, .obs * is always a 2 Digit number This is what I have tried ALLOWED_EXTENSIONS = set(["*+'n'" , "*+'o'"]) How can I change the ALLOWED_EXTENSIONS to accept above mentioned common patterns. I have used flask documentation for the upload file reference I think I have to change this functions def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS Continue reading...