JSFiddle - React, Tailwind, and code Playground by Vladimir Kutepov October 02, 2017 HTML <form> <input type="text" pattern="(?=(?:\D*\d){2}).{8,}" /> <button>Send</button> </form>