August 16, 2012

Space in Regular Expression

Best approach is to create a method in js file using jquery to create space in regular expression

$.validator.addMethod("alpha",
function (value, element) {
var alphaRegExp = new RegExp("^[\\sa-zA-Z]*$");
if (alphaRegExp.test(element.value)) {
return true;
}
else return false;
},
"Please enter alphabet"
);