Why not just have the Regex do the replacement?
private string ReplaceProductDescription(string description)
{
string pattern = @"/en/products/(?<pn1>\d{4})/(?<pn2>\d{4})\.aspx";
Regex regEx = new Regex(pattern);
return regEx.Replace(description, "newString pn1 here:${pn1} pn2 here:${pn2}");
}
And you probably want to pre-construct the
Regex
once, instead of on each call.