im trying to make a regex for matching a set of words.
For example, if i am matching a set of words - American Tea
Then in the string American Tea is awesome. Do you like American Tea? love WowAmerican Tea #American Tea
there will be only 2 matches here,
'American Tea is awesome. Do you like American Tea? love WowAmerican Tea #American Tea'
So, i am trying to do only full matches of the word set.
I tried some approaches, but havent got the correct regex :( If anyone can help or can point me in a direction it would be really helpful.
Check this
'American Tea lalalal qwqwqw American Tea sdsdsd #American Tea'.match(/(?:^|\s)(American Tea)(?=\s|$)/g)
the result of this is ["American Tea", " American Tea"]
I do not want the space in the second match, i want the match result to be ["American Tea", "American Tea"]
(no space in front of the second American Tea)