Contributions
File name pattern regex filter not working
I have a file parameter on which I want to apply a regex pattern so that only file names with a certain set of chars is allowed. For example, I only want file names like this to be allowed through: filename.csv fileName.csv FileName.csv FILENAME.CSV file-name.csv file_name.csv file-name123.csv file_name123.csv In other words, I want file name to have ONLY: alphanumeric with dash, underscore and dot, mixed cases, (NO SPACES) The following pattern allows everything, even file names with spaces and should not. parameters: - name: file type: file in: formData description: Select the Catalog file to upload required: true format: file pattern: '[\w._-]+' The following pattern doesn't allow anything through... parameters: - name: file type: file in: formData description: Select the Catalog file to upload required: true format: file pattern: '^[a-zA-Z0-9._-]+$' Looked through Docs and saw nothing helpful for this. Am I missing something? Thanks!490Views0likes0Comments