JSFiddle - React, Tailwind, and code Playground by Nicolas PUJOL June 18, 2015 JavaScript var str = "123456A"; alert(str.match(/[0-9]{6}[ABCDE]{1}/) && str.length === 7);