I have the following pattern:
private const string _usernamePattern = "Username: <strong>.*</strong>";
and code:
private string Grab(string text, string pattern)
{
Regex regex = new Regex(pattern);
if (!regex.IsMatch(text))
throw new Exception();
else
return regex.Match(text).Value;
}
so, it works fine for string like:
Username: <strong>MyUsername</strong>
But I need grab only MyUsername
, without <strong>
tags.
How to do it?