Grabing hashtagged word from a string using regex
c#, regex
Solution
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);
}
Problem
Well, as the title says... I want to grab a certain word that is hashtagged in a string. Example: This is a string that #contains a hashtag! I want to pick out the word contains from the string as a new string. I can imagine that this is a very simple problem, but I really can't get it to work.