I need to read file name from a text box which is given by the user for creating file in windows. So I need to restrict the special characters to be entered in that text box \ / : * ? " < > |
How I can validate in javascript function using regular expression? I tried the below code.
var rg1 = new RegExp('/^[^\\/:\*\?"<>\|]+$/');
if (rg1.test($("qcAttachmentName").value)) {
showErrorDetails("Enter a valid Attachment Name", 0);
return "";
}
But it is not working.