two different Patterns in the same HTML input

Asked

Viewed 122 times

2

Hello, I wonder if there is a way to put more than one Pattern as an alternative to the first in html

for example, a person can only use Gmail.com and Hotmail.com, so that they fill in with a OR another

ex:

<input type='text' pattern='[A-Za-z0-9._%+-][email protected]'>

1 answer

7


Cannot add more than one regex to the Pattern attribute, what can be done is to add a group containing what you want.

<input type='text' pattern='[A-Za-z0-9._%+-]+@(gmail|hotmail).com'>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.