[Solved] I have a string in javascript. I need to pick all strings between “{” and “}”


Use regular expression /{(.*?)}/g:

var re = new RegExp('{(.*?)}', 'g');
result = re.exec('QUO-{MM/YYYY}-{SERVICEGROUP}');

Will output: ["{MM/YYYY}", "MM/YYYY"]

Edit:

'QUO-{MM/YYYY}-{SERVICEGROUP}'.match(/{(.*?)}/g);

Will output: ["{MM/YYYY}", "{SERVICEGROUP}"]

4

solved I have a string in javascript. I need to pick all strings between “{” and “}”