Imagine having the string below:
Lorem #test ^%#test ipsum#test dolor #test sit #testamet.
^^^^^ ^^^^^
What regular expression should be used to specifically select the highlighted #test
instances? It is important to only choose instances that are not part of another word or contain additional characters.
If searching for just test
, you could use /\btest\b/g
. However, it appears that \b
only works when the text begins with a word character. Any ideas on how to approach this?