Home > Back-end >  How to allow two input patterns HTML
How to allow two input patterns HTML

Time:05-01

I'm looking to allow user to input either one the allowed patterns ,i didn't want to use Select list or Radio for Design purposes . i tried many approaches but non one them allowed me to get to what i truly want.

<form action="" method="post">

<input type="text"  name="study" placeholder="Enter your year of study L1-3,M1-2 "  pattern="[L-l-M-m] [1-2-3]" maxlength="2" title="only L1,L2,L3 and M1,M2 are allowed" required>
<button name="submit"  type="submit">Register</button>

</form>

CodePudding user response:

found the answer [L]{1}[1-3]|[M]{1}[1-2] using https://regex101.com and using logical or enter image description here

CodePudding user response:

Use this pattern: [LM]{1}[0-9]{1}

You can check if this work for you with this tool: https://regex101.com

  • Related