JSFiddle - React, Tailwind, and code Playground JavaScript var str = "(as(dh(kshd)kj)ad)... ()()"; document.write(str.match(/\((.*?)\.\.\./m)[1] );