Assume there is a string "aaaa/{helloworld}/dddd/{good}/ccc",
I want to get an array which contains the variables "helloworld" and "good" which are in braces {}.
Is there a simple way to implement this using regex?
Below function doesn't work:
function parseVar(str) {
var re = /\{.*\}/; // new RegExp('{[.*]}');// /{.*}/;
var m = str.match(re);
console.log(m)
if (m != null) {
console.log((m));
console.log(JSON.stringify(m));
}
}
parseVar("aaaa/{helloworld}/dddd/{good}/ccc");