I'm looking for a regex that will only allow characters e, b, z, l to be typed in the user input.
I believe this is wrong ? :
/[ebzl]*/i
I know I need to use a class but I don't know how and couldn't find any relevant tutorials for the above online.
$('input').keyup(function () {
if (/[ebzl]*/i.test($(this).val())) {
// do something
}
});
锚定您的正则表达式:
if (/^[ebzl]+$/i.test($(this).val())) {
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.