why doesn't this simple html code work? (pattern)

could somebody tell me why this simple code doesn't work? I type a random email address with .com at the end and I receive an error that this address doesn't have the right format.

<!DOCTYPE html>
<html>
<body>


<form action="demo_form.asp">
  E-mail: <input type="email" name="email" pattern="\.com$">
  <input type="submit">
</form>

</body>
</html>

Answers


Maybe it works

<form action="demo_form.asp">
E-mail: <input type="email" name="email" pattern="+\.com$">
<input type="submit">
</form>


Try this pattern. It will validate only .com emails.

pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.com$"

There's a problem with your pattern, try using this instead pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$"


Need Your Help

Mule ESB - http:outbound-endpoint no effect

mule esb mule-studio

I have problem with flow defined like:

Underscore as well to regular expression

regex

I need alpha numeric string with hyphen (-) and underscore (_). but - and _ can't come alone. There must be some aplha or alpha numeric text with - or _.