JSFiddle - React, Tailwind, and code Playground

by Alexander Lashchevsky

JavaScript

let str = 'this is {foo} afoo {bar} sentence';

let matches = str.match(/\{(\w+)\}/gi).map(match => match.substring(1, match.length - 1));

console.log(matches);