JSFiddle - React, Tailwind, and code Playground
JavaScript
var targetText = '@{foo} in a @{bar} for a @@{foo} and @{foo}@{bar} things.'
var reg = /@@|(@{[a-z-]*})/g;
var result;
while((result = reg.exec(targetText)) !== null) {
if (result[1] !== undefined) {
alert(result[1]);
}
}