Reputation: 2816
So far I have this:
@(\w+)(?=\s|[.,?!:;-]|$)
Which works well for my purpose, except that it includes things like @@jhgdsj which I want to exclude. How would I exclude anything for more than one @ at the start of any "word"?
[Edit] Example here: example
Matches desired for bolded words (aaa, ddd, fff): @aaa then @@bbb also ccc@ccc and @ddd @fff not @@@ggg
Upvotes: 0
Views: 97
Reputation: 174706
Just add the start pattern to allow only one @
at the start,
^@(\w+)(?=\s|[.,?!:;-]|$)
OR
(?:^| )@(\w+)(?=\s|[.,?!:;-]|$)
Upvotes: 3