Hi sun21170d,
Refer below sample.
HTML
<asp:Label ID="lblData" runat="server" />
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
string data = "<div>hello 123 xyz 567</div><pre>I am fine xyz 125 xyz 20</pre>";
string result = System.Text.RegularExpressions.Regex.Replace(data, @"<pre>(.*?)</pre>", m =>
{
return m.Groups[1].Value.Replace("xyz", "63");
});
lblData.Text = result;
}
VB.Net
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim data As String = "<div>hello 123 xyz 567</div><pre>I am fine xyz 125 xyz 20</pre>"
Dim result As String = System.Text.RegularExpressions.Regex.Replace(data, "<pre>(.*?)</pre>",
Function(m) m.Groups(1).Value.Replace("xyz", "63"))
lblData.Text = result
End Sub
Output
hello 123 xyz 567
I am fine 63 125 63 20