I am trying to develop some regex to find all words that start with an @:
I thought that \\@\\w+ would do it but this also matches words that have @ con
\\@\\w+
Use \B@\w+ (non-word boundary).
\B@\w+
For example:
string pattern = @"\B@\w+"; foreach (var match in Regex.Matches(@"@help me@ ple@se @now", pattern)) Console.WriteLine(match);
output:
@help @now
BTW, you don't need to escape @.
@
http://ideone.com/nsT015