Answer : Use the following function to remove unwanted character / string in Javascript
1 2 3 4 5 6 | function removeSpecialChar(str){ if(str == null || str == ''){ return ''; } return str.replace(/[^\w\s]/gi, ""); } |
How To Use :
1 | removeSpecialChar('Seegatesite&%$,,com'); |
The Result :
Conclusion :
Using regex expression you can manage string according to your wishes.
Leave a Reply