Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to check for special charaters with spaces javascript

var format = /[ `!@#$%^&*()_+-=[]{};':"|,.<>/?~]/;
//            ^                                       ^   
document.write(format.test("My@string-with(some%text)") + "<br/>");
document.write(format.test("Mystringwithspaces") + "<br/>");
document.write(format.test("MyStringContainingNoSpecialChars"));
 Run code snippetHide results
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #special #charaters #spaces #javascript
ADD COMMENT
Topic
Name
5+5 =