using System.Text.RegularExpressions;
public static void Main()
Console.WriteLine("--------------------------------------------------------------------------------");
Console.WriteLine("--------------------------------------------------------------------------------");
Console.WriteLine("END");
var pattern = "^/woman/ready-to-wear/short-dresses(.*)$";
var replace = "/men/clothing/dresses";
var test1 = "/woman/ready-to-wear/short-dresses.html";
var test2 = "/woman/ready-to-wear/short-dresses/dress-in-viscose-jersey-with-coral-reef-print.html";
var regex = new Regex(pattern);
Console.WriteLine("Regex pattern: '{0}'", pattern);
Console.WriteLine("Regex replace: '{0}'", replace);
TestValue(regex, test1, replace);
TestValue(regex, test2, replace);
var pattern = "/(.*)-en/woman/ready-to-wear/short-dresses.*";
var replace = "$1-en/woman/clothing/dresses";
var test1 = "/gb-en/woman/ready-to-wear/short-dresses.html";
var test2 = "/gb-en/woman/ready-to-wear/short-dresses/dress-in-viscose-jersey-with-coral-reef-print.html";
var test3 = "/us-en/woman/ready-to-wear/short-dresses.html";
var test4 = "/us-en/woman/ready-to-wear/short-dresses/dress-in-viscose-jersey-with-coral-reef-print.html";
var regex = new Regex(pattern);
Console.WriteLine("Regex pattern: '{0}'", pattern);
Console.WriteLine("Regex replace: '{0}'", replace);
TestValue(regex, test1, replace);
TestValue(regex, test2, replace);
TestValue(regex, test3, replace);
TestValue(regex, test4, replace);
static void TestValue(Regex regex, string input, string replace)
Console.WriteLine("'{0}' will become '{1}'", input, regex.Replace(input, replace));
Console.WriteLine("'{0}' is not a match", input);