JSFiddle - React, Tailwind, and code Playground JavaScript var m = 'xaxbxc'.match(/x\w/g); alert(m.length + " " + m[2])