Hope somebody can help me regarding regular expression.

I have a shortcode format "<!--myproductsku-->" in the string, I want to use regular expression to extract myproductsku. And if there is a match replace "<!--myproductsku-->" with "This is my myproductsku.".


Rey

Regex.Replace("<!--myproductsku-->","<!--\s+-->","")

try this

// Static method:
if (Regex.IsMatch(txtName.Text, @"<!--myproductsku-->"))
{
      string result = reg.Replace("<!--myproductsku-->" ,"This is my myproductsku.");
       Console.WriteLine("Replacement String: {0}", result);
}