The text validation in jquery, String contains exact substring not partial.
Ex: Input String : Hello World Sub String : Hello There are validation in like str.indexof(SubString) >-1 or /SubString/.test(str) If some one enters He in the input text box it validates the above condition where it should validate exact string "Hello" not for He. How to do this. Your suggestion will be highly appreciated.
/Hello/.test(Hello World) - correct validation as Hello World
/Hello/.test(He..) - It should n't validate, Where it validates for He llo in He..
setValidation: function(){
$.validator.addMethod("no_Hello_word", function(value) {
return /hello/.test(value) || /HELLO/.test(value);
}, "Text mustn't contain word hello/HELLO");
}