I am trying to match an exact word with multiple patterns using regex.
What I tried:
pattern: "\b(@DOG|@DOG1|@DOG2)\b", text: "@DOG2".
I want to match exact text "@DOG2"
using these patterns, and the expected result should be: there is only 1 match "@DOG2"
. How can I change the pattern text to achieve this?
Interestingly, if I remove all '@' symbol from above text, the regex will work as expected:
pattern: "\b(DOG|DOG1|DOG2)\b", text: "DOG2".
Does '@' affect the result? How can I avoid this?