How can I use String.prototype.indexOf() to find one or more matching string patters within a given string?
For example:
I have a string to test:
/accounts/{account}/project/{project}I want to test for the existence of one or more string patterns of
{...}where...could have anything. In this example they are:account,projectI would like to
String.prototype.indexOf()to retrieve an Object that has a collection of start and end indexes for each instance of the matched pattern. In this example I would like to have:[{ start: 10, end: 18},{start: 28, end: 36}]
I've been able to make an object when there is just one match, but I am unsure how to get for multiple.