I need to capture everything between curly brackets. So if I have the string:
{this} {is a} blah {test}
should return [this, is a, test].
My code looks like this:
var myString = "{this} {is a} blah {test}";
var parts = (/{([^{}]+)}/g).exec(myString);
// parts = [{this}, {is a}, {test}]
var parts = (/{([^{}]+)}/g).exec(myString);
// parts = [{this}, this]
Any ideas/help?
I think you’re over-egging the pudding:
Live Example | Source