I’m playing around with the pattern attribute in html5. It accepts a regular expression in order to deem a form-field valid or invalid.
I want a field to be valid if it contains the word John and nothing else. How do I do this with regular expression?
Should be something like this:
Edit: Actually, it looks like
^and$are implied, so this would be sufficient:As pointed out by Tim Pietzcker, to specify a case insensitive match, you would use the following: