Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • hey dude, thank you very much, it works well, But want to know, 1. what was my mistake, as indexOF should work. 2. IS .test(), will be always good for this kind of validation. Commented Aug 5, 2013 at 6:55
  • @SAM it was because of the return true in the else portion of the index condition. see jsfiddle.net/arunpjohny/fAywy/3 the problem is if the first character is not a special character you where not continuing the tests... it was just returning true Commented Aug 5, 2013 at 7:00