Could someone please help me to remove special characters from a string using javascript or Jquery.
Note: I would like to remove only a specific set of special characters but not replacing it with any character. Below is the code i am trying. Thanks in advance.
Code:
filename = filename.replace(/[&\/\\#,+()$~%'":*?<>{}|]/g, '').replace(/\u201C/g, '').replace(/\u201D/g, '').replace(/\s+/g, '');
Sample string Name:
Test5 & special~, #, %, & , ,, , , , , , , , “”
Actual Result:
(Test5 space special-----------------------spaces till here)
Expected Result:
Test5 special