Reputation: 41
I want to get a string between two substrings.
For example:
Code:
'{{something}} Space {}} Space2 {{}}'.match(/{(.*?)}/g)
I want it to be:
['{something}','}','{}']
but it returns:
['{{something}','{}','{{}']
Upvotes: 0
Views: 231
Reputation: 50787
This looks like it would get the answer you want in this case, but the general case is not very clear to me:
'{{something}} Space {}}'.match(/{([^{]*?)}/g)
Upvotes: 2