I created this regex to match all words that start with “@” in my string, there could be something before the @ tokens as well. it works well but it also catches email addresses and i would like to fix that.
(?<=@)\w+\b
Example string would be:
hello @bob, how are you? @mark, @emma and @chief are with me. email me
at test@email.com!
Can you help?
You could use the next expression:
which starts at a non-word boundary (
\B). You could also rewrite it using negative lookahead like this: