jquery - Validating file name for creating file in windows, using regular expression in javascript -


i need read file name text box given user creating file in windows. need restrict special characters entered in text box \ / : * ? " < > |

how can validate in javascript function using regular expression? tried below code.

var rg1 = new regexp('/^[^\\/:\*\?"<>\|]+$/'); if (rg1.test($("qcattachmentname").value)) {     showerrordetails("enter valid attachment name", 0);     return ""; } 

but not working.

your script , regex pattern have errors. please find fiddle here working sample


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -