I apologize if this is a duplicate, but I can't seem to find my answer and I have been looking for sometime now. Using C# or a regular expression, I'm trying to find and replace all hashtagged words within a string and wrap them in HTML tags.
Example Input Text:
I would like to wrap #AllHashtags with html #Code to make it #StandOut
Ideal Output Text
I would like to wrap <span class="yellow">#AllHashtags</span> with html <span class="yellow">#Code</span> to make it <span class="yellow">#StandOut</span>
I've tried the following, but not luck
tweet.Text = "<span class='yellow'>" + tweet.Hashtags + "</span>";
tweet.Text.Replace("#", "<span class='yellow'>#");
tweet test = tweet.Text.IndexOf("#", 0);
var containsHastag = tweet.Text.Contains("#", StringComparer.OrdinalIgnoreCase);
Any help would be appreciated.
