I have a string with one or more placeholders in the following format: $([name])
The [name] can be any word (containing alfanumeric chars) and is case sensitive.
Example1: 'The $(Quick) Brown fox jumps over the lazy dog'
Example2: '$(the) $(Quick) Brown fox jumps over $(the) lazy dog'
Example3: '$(the) $(Quick) Brown $(fox) jumps over $(the) lazy $(dog)'
What is the best way in javascript to retrieve all place holders so that we have following result:
Example1: ['Quick']
Example2: ['the', 'Quick', 'the']
Example3: ['the', 'Quick', 'fox', 'the', 'dog']
I also need to retrieve a unique list of placeholders, thus:
Example1: ['Quick']
Example2: ['the', 'Quick']
Example3: ['the', 'Quick', 'fox', 'dog']
Thank you.