This is my regex matcher.
const regex = /\b(?:days|weeks|months)\b/gi
If I pass a string like
There are 5 $days/$ and ten %weeks/% and 7 $months/$
I want to return an array with all the matches for each word like
['months', 'days', 'weeks']
or
['$months/$', '$days/$', '%weeks/%']
However, this string should not return days since there is no delimiter $ or /$ or % or /%
There are 5 days and ten %weeks/% and 7 $months/$
would return
['months', 'weeks']
or
['$months/$', '%weeks/%']
Here is what I have tried without success (just for days for now)
/\b(?:\$days|weeks|months)\b/gi
/\b(?:\$days\/\$|weeks|months)\b/gi
What is the correct pattern to match these 3 specific words with these particular delimiters that I append to the end of them?