I am trying to get a value in between certain text of html , so far not successful ,I can not use html aglity pack as it gives the data only present in between html tags
public static string[] split_comments(string html)
{
html = html.ToLower();
html = html.Replace(@""""," ");
the actual line in html is this
//<meta itemprop="rating" content="4.7"> the 4.7 value changes every time and I need to get this value
Match match = Regex.Match(html, @"<meta itemprop=rating content=([A-Za-z0-9\-]+)\>$");
if (match.Success)
{
// Finally, we get the Group value and display it.
string key = match.Groups[1].Value;
}
So I am trying to get a tag of html and in that tag I wish to get the data whic is variable all the time .
&or&eacut;are used, or numeric entities likea? What if the attributes are in another order, attribute content is placed over multiple lines or XML vs HTML tag endings are used? Regexes are good, but not for this task. See stackoverflow.com/questions/3406174/… and check HtmlAgilityPack to do this the stable and reliable way.