Question: I have a method that returns a string in the following format:

```
string tableTag = "<th><a href="Boot_53.html">135 Boot</a></th>"

```

I want to get the value of the `href` attribute and store it into another string called `link`:

```
string link = "Boot_53.html"

```

In other words, `link` should be assigned the `href` attribute in the string. How can I accomplish that?

Answer: 
If you know that the html is actually a xhtml (an html which conforms to the xml standarts [more or less]) you can parse is simply with tools dedicated to xml (which are generally simpler than those for html).

```
var hrefLink = XElement.Parse("<th><a href=\"Boot_53.html\">135 Boot</a></th>")
                       .Descendants("a")
                       .Select(x => x.Attribute("href").Value)
                       .FirstOrDefault();

```
You can use Regex:

```
string input= "<th><a href=\"Boot_53.html\">135 Boot</a></th>";
string regex= "href=\"(.*)\"";
Match match = Regex.Match(input, regex);
if (match.Success)
{
    string link= match.Groups[1].Value;
    Console.WriteLine(link);
}

```