JSFiddle - React, Tailwind, and code Playground
by jfriend00
CSS
body {font-family: "Courier New"; font-size: 13px;}
JavaScript
function getBracedText(input) {
var re = /\{(.*?)\}/g, matches, output = [];
while (matches = re.exec(input)) {
output.push(matches[1]);
}
return(output);
}
var str = "The {quick} brown {fox} jumped over the {fence}";
var results = getBracedText(str);
document.body.innerHTML = '["' + results.join('","') + '"]';