Custom Regex Expression = $ ~ # № \ ; < > % / -
i need create regular expression match following characters on input:
= $ ~ # № \ ; < > % /
i don't have idea how combine or setup regex case.
i have this
$('input').bind('keypress', function (event) { var regex = new regexp(???); var key = string.fromcharcode(!event.charcode ? event.which : event.charcode); if (!regex.test(key)) { event.preventdefault(); return false; } });
need prevent symbols typing
try this:
var pattern = /^[=$~#№\\;<>%/]*$/
and if want letters , numbers try this:
var pattern = /^[a-za-z0-9=$~#№\\;<>%/]*$/
Comments
Post a Comment