using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(/sites(?:/[^/\""]+){2}/SitePages/[^/\""]+)\.aspx(?=\"")";
string substitution = @"$1.html";
string input = @"<div class=""ms-wikicontent ms-rtestate-field"" style=""padding-right: 10px""><div class=""ExternalClass8E56354CC4314DBA861E187B689F3A2B""><table id=""layoutsTable"" style=""width:100%""><tbody><tr style=""vertical-align:top""><td style=""width:100%""><div class=""ms-rte-layoutszone-outer"" style=""width:100%""><div class=""ms-rte-layoutszone-inner"" role=""textbox"" aria-haspopup=""true"" aria-autocomplete=""both"" aria-multiline=""true""><a id=""0::Home|Home"" class=""ms-wikilink"" href=""/sites/Team/Project/SitePages/Home.aspx"">Home</a> - <a id=""1::Jenkins|Jenkins"" class=""ms-wikilink"" href=""/sites/Team/Project/SitePages/Jenkins.aspx"">Jenkins</a><h1 class=""ms-rteElement-H1"">Jenkins Integration with Deployment Tools</h1>";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx