I have this regex for detecting @xxx
/(?:@)(.*[a-zA-Z0-9]*)/
it matches even when the @xxx is not separated from another string from the left (when it's typed in the middle of an input line).
xxx@xxx will match too so i added \s to require a space in the begining .Now it's
/\s(?:@)(.*[a-zA-Z0-9]*)/
But the problem is there isn't a match when the @xxx is typed in the begining of a line (the white space is still required) and i need it match in that case.
I tried to get inspired by https://stackoverflow.com/a/19973707/170592 so i added ^[^-\s] in the begining of the regex to make it
/^[^-\s](?:@)(.*[a-zA-Z0-9]*)/
But it didn't work neither.