0

Currently I am using a pattern element to verify whether an email contains a specified domain:

<input type="email" id="ms_email" name="ms_email" required placeholder="Corporate Email address" **pattern="\w+@barclays\"** oninvalid="this.setCustomValidity('Please enter your corporate email')" style="float:left; margin-left: 20px; clear:right;">

But now I want it to validate if email contains 'x' or 'y'.

What would be the best way? As pattern only seems valid for one domain not more than 1.

Thanks

Callum Linington
  • 14,213
  • 12
  • 75
  • 154
Yondaime14
  • 113
  • 1
  • 8
  • Just to confirm , you're only accepting email ids from a single domain right? – Satej S Jun 16 '16 at 10:17
  • I can imagine using an `input` element to fill in the part before the `@`, combined with a `select` element that holds the options. Or fixed in case of only one option. Easier to validate imho. – Tim Vermaelen Jun 16 '16 at 10:31
  • @SatejS from multiple domains e.g. if it was only from supermarkets like tesco or sainsbury. However the email can be @ finance.sainsburys.com or @ tesco.com. So email after the @ must contain 'sainsbury' or 'tesco' to be accepted as valid – Yondaime14 Jun 16 '16 at 11:14

0 Answers0