Q:

Match and Replace a regular expression patteren

I want to validate a regular expression pattern and replace its value with my dynamic value
the pattern is 
$[ABCD]$test$[xyz]$

first i have to parse and validate such pattern and if its fine Replace the value "ABCD" and "xyz" with my dynamic value in c#.net
please help

A:

If I got your question right, you just want to replace ABCD and xyz with some values that you may hand to the methode where you check the expression. 
Try this code
        string value1 = "firstValue";
        string value2 = "secondValue";

        Regex expression = new Regex(string.Format("$[{0}]$test$[{1}]$", value1, value2));
        expression.Match(input);

you will receiv a Regex that looks like:
$[firstValue]$test$[secondValue]$
Did I understood your question right?

