Hi Readers,
Some times we have to remove special characters from string. Here is the java script + Regexp code to remove characters from java-script string:
Some times we have to remove special characters from string. Here is the java script + Regexp code to remove characters from java-script string:
updatedString = Stringtobefiltered.replace(/[^\w\s]/gi, '')
One more regex expression which is generally required in many cases which allow users to imput alphanumeric characters and three special characters:
/^[a-zA-Z0-9_.:]*$/
The above regex will allow A-Z, a-z, 0-9,: , . and _ in input box.
Hope this will help you :)
No comments:
Post a Comment