I am looking to identify all strings that begin with an @ symbol, unless they also contain other characters before the @. For instance, in @one @two and bla@three
, I want to identify @one
and @two
, but not @three
. This is for highlighting usernames in a chatroom.
These strings may appear anywhere within a sentence, whether at the beginning or in the middle.
I initially believed that (?![a-zA-Z])@[a-zA-Z]+
would suffice, but it still recognizes @three
as well.