I want to use JavaScript (can be with jQuery) to do some client-side validation to check whether a string matches the regex:
^([a-z0-9]{5,})$
Use test() method :
test()
var term = "sample1"; var re = new RegExp("^([a-z0-9]{5,})$"); if (re.test(term)) { console.log("Valid"); } else { console.log("Invalid"); }