I want a regex which only allows a-z A-Z and special characters like é (accented). I don't want any special characters like @,.$%^&"
lastName.addEventListener(
'keyup',
inputValidation.bind({
// reg: /^[A-Za-z ] $/,
reg: /^[a-zA-Z]*$/,
element: lastName,
error: 'Only alphabets allowed!',
})
);
I have tried many regex but they also restrict characters like é. I want to allow special alphabets and simple alphabets
CodePudding user response:
Try
lastName.addEventListener(
'keyup',
inputValidation.bind({
reg: /^[a-zA-ZÀ-ÖØ-öø-ÿ]*$/,
element: lastName,
error: 'Only alphabets allowed!',
})
);