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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -