In my angular app, when user tries to upload file using file widget or in matrix widget, I want to enforce a validation on file name by applying my regex so that it should only allow files matching with the pattern, else it should throw an error message. I am facing challenge on how to do this check in angular app. I understood so far is that I need to write something like below in my survey.component.ts
CodesurveyModel.onUploadFiles.add((survey, options) => {
const question = survey.getQuestionByName(options.name);
options.files.forEach(file => {
// check my file name is against my regex and accept only if it matches, else throw error.
})
})
I am not sure how to write custom regex validator and do check here. Any help much appreciated! Thanks.