Explain what does function below does.

Give an example, how would you use it.

public static string TestQuestion(string date)
return Regex.Replace(date,"([0-9]+)/([0-9]+)/([0-9]+)","$2/$1/$3");


If you look on the expression it is obvious that it defines three numeric groups separated by the slash. The replace is simple rearrangement of these groups.

So, in this case following example:

string date = "01/02/03";


Would output: “02/01/03”

Which can be an example of translating European date into American and vice versa.

Answers and Comments