Best way to replace Urls in .Net application
Since you just getting the host url, remove the dots, then append it as a subdomain to the given domain with the approprate protocols (Https or Http). You can do this : 

public IEnumerable&lt;string&gt; GetRoutedUrls(IEnumerable&lt;string&gt; urls, string domain, int httpPort, int httpsPort)
{
    if(urls == null) { throw new ArgumentNullException(nameof(urls)); }

    if (string.IsNullOrEmpty(domain)) { throw new ArgumentNullException(nameof(domain)); }

    foreach (var url in urls)
    {
        if (string.IsNullOrEmpty(url)) { yield return null; }

       if(Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out Uri uri))
        {
            yield return uri.Scheme == "https" ? $"https://{uri.Host.Replace(".", string.Empty)}.{domain}:{httpsPort}" : $"http://{uri.Host.Replace(".", string.Empty)}.{domain}:{httpPort}";
        }
    }
}


usage : 

var urls = GetRoutedUrls(grupo.Paginas.Where(p =&gt; p.Proxy).Select(x=&gt; x.URL), "example.com", 81, 444)


UPDATE

After clarifying things, I think you don't need Regex since you're replacing an exact match of urls. Regex would be more useful if you want to search for unknown inputs.

To give you an example of that, if we want to get every single url in the response we can use

Regex.Matches(response, @"(https?://)(.*)(\d)", RegexOptions.IgnoreCase)


This would get every single url that has specified a port (e.g. https://example.com:443). Then, we can do stuff on them. 

In your method, is different a bit. You already have defined the urls, and you want to check for these urls in your response, if they exist, you want to change them by appending them as subdomain to the given domain, and giving them a new port as well. 

Unless if there is any special cases that is not covered or mentioned in your post (which forced you to use Regex in first place), I think it would be a straight forward approach if we just use string.Replace directly. 

public string ReplaceResponseUrls(IEnumerable&lt;string&gt; urls, string response, string domain, int httpPort, int httpsPort)
{
    if (urls == null) { throw new ArgumentNullException(nameof(urls)); }

    if (string.IsNullOrEmpty(response)) { throw new ArgumentNullException(nameof(response)); }

    if (string.IsNullOrEmpty(domain)) { throw new ArgumentNullException(nameof(domain)); }

    var responseStringBuilder = new StringBuilder(response);

    foreach (var url in urls)
    {
        if (string.IsNullOrEmpty(url)) { continue; } // skip to the next url

        if (Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out Uri uri))
        {
            responseStringBuilder.Replace(
                $"{uri.Scheme}://{uri.Host}:{uri.Port}", // old url
                $"{uri.Scheme}://{uri.Host.Replace(".", string.Empty)}.{domain}:{(uri.Scheme == "https" ? httpsPort : httpPort)}" // new url
                );
        }
    }

    return responseStringBuilder.ToString();
}


Try this approach first, do some tests on it, and let me know if you need any help with it.