I have jQuery validation plugins (http://docs.jquery.com/Plugins/Validation) installed on my website.
I’m using this code to validate alpha-numeric from text field, and it works. but it doesn’t allow space and dash (-).
$.validator.addMethod("titleAlphaNum", function(value, element, param)
{
return value.match(new RegExp("^" + param + "$"));
});
how to make it works with space and dash? thanks.
working demo http://jsfiddle.net/cAADx/
/^[a-z0-9\-\s]+$/ishould do the trick!g = /g modifier makes sure that all occurrences of “replacement”
i = /i makes the regex match case insensitive.
good read: http://www.regular-expressions.info/javascript.html
Hope this helps,
code
Will remove this image in 2 mins see here robert like this http://jsfiddle.net/5ykup/