Grabing hashtagged word from a string using regex
How good do you want this pattern to be? In theory just:
"(?<=#)\w+"
would do it.
Edit, for more answer completeness:
string text = "This is a string that #contains a hashtag!";
var regex = new Regex(@"(?<=#)\w+");
var matches = regex.Matches(text);
foreach(Match m in matches) {
Console.WriteLine(m.Value);
}
string input = "this is a string that #contains a hashtag!";
var tags = Regex.Matches(input, @"#(\w+)").Cast<Match>()
.Select(m => m.Groups[1].Value)
.ToList();