I'm trying to search for all occurrences of a group of words in a paragraph with the following regex:
'(?i)\W(the|if|but|then|is|with)\W'
The result is returned with the issue that some occurrence of a the word are missed.
For example in a test paragraph with 3 occurrences of the word 'the', this regex finds only the second occurrence missing the first and third one.
What is the problem with this regex to find all the words in a paragraph?