I’ve an HTML field in a form and, using JS and Regex, I must restrict the characters the user can insert in the field. The user of the form can only insert the following characters ( ) * + ^ / X x, and numbers and spaces (when he digits or pastes a different character nothing is written). Is this possible? I need the Regex, I eventually know how to do with JS.
I’ve an HTML field in a form and, using JS and Regex, I must
Share
Try this regex
Here we are trying to find a pattern which contains none of the allowed characters. If you find it this means that the character entered was wrong.