Hi Chand,
Please refer below Sample.
HTML
<asp:Label id="lblEmail" runat="server" />
<hr />
<asp:Label id="lblEmails" runat="server" />
Namespace
C#
using System.Text.RegularExpressions;
VB.Net
Imports System.Text.RegularExpressions
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string testText = @"riya vyas"" <riyavyas1997@gmail.com>";
int startindex = testText.IndexOf('<');
int endindex = testText.IndexOf('>');
string outputstring = testText.Substring(startindex + 1, endindex - startindex - 1);
lblEmail.Text = outputstring;
string input = @"""xyz abc"" <xyzabc2571997@gmail.com>""riya vyas"" <riyavyas1997@gmail.com>";
string[] testing = Regex.Matches(input, @"\<(.+?)\>")
.Cast<Match>()
.Select(s => s.Groups[1].Value).ToArray();
lblEmails.Text = string.Join(", ", testing);
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim testText As String = "riya vyas"" <riyavyas1997@gmail.com>"
Dim startindex As Integer = testText.IndexOf("<"c)
Dim endindex As Integer = testText.IndexOf(">"c)
Dim outputstring As String = testText.Substring(startindex + 1, endindex - startindex - 1)
lblEmail.Text = outputstring
Dim input As String = """xyz abc"" <xyzabc2571997@gmail.com>""riya vyas"" <riyavyas1997@gmail.com>"
Dim testing As String() = Regex.Matches(input, "\<(.+?)\>").Cast(Of Match)().Select(Function(s) s.Groups(1).Value).ToArray()
lblEmails.Text = String.Join(", ", testing)
End If
End Sub
Screenshot