In this short article I will explain how to get and extract Inner Text from HTML HyperLink (Anchor tags) using Regular Expression (Regex).
 
HTML Markup
Below is the HTML Markup where I have TextBox to enter HTML content with HTML Anchor Tags or Hyperlinks, a Label to display the extracted Inner Text of HTML Anchor Tags or Hyperlinks and a Button to trigger the conversion
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:TextBox ID="TextBox1" runat="server" TextMode = "MultiLine" Height = "150px" Width = "500px" Text = "<a href = 'http://www.google.com'>Google</a> is a Search Engine. <a href = 'http://www.asp.net'>ASP.Net</a> is a web technology"></asp:TextBox><br />
    <asp:Button ID="btnStrip" runat="server" Text="Remove Hyperlinks"
        onclick="btnStrip_Click" />
        <br />
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    </form>
</body>
</html>
 
 
Namespaces
C#
using System.Text.RegularExpressions;
 
VB.Net
Imports System.Text.RegularExpressions
 
 
Stripping the HTML Anchor Tags (Hyperlinks)
Inside the following Button click event handler, the Replace method of the Regular Expression class is used to remove all the HTML Anchor Tags (HyperLink) and retain its Inner Text.
C#
protected void btnStrip_Click(object sender, EventArgs e)
{
    Label1.Text = Regex.Replace(TextBox1.Text, "</?(a|A).*?>", "");
}
 
VB.Net
Protected Sub btnStrip_Click(sender As Object, e As EventArgs)
    Label1.Text = Regex.Replace(TextBox1.Text, "</?(a|A).*?>", "")
End Sub
 
 
Demo
 
Downloads
Download Code