I am trying to use regex in C# to edit string format.
Previous format is 09/08/2015 or 9/08/2015 and pattern I tried is "([0-9]{1,}|[0-9]{2,})/[0-9]{2,}/[0-9]{4,}"
New format should be 2015 08 09
I am trying to use variables from match, but it shows only $1 and not $2 or $3
string pattern = "([0-9]{1,}|[0-9]{2,})/[0-9]{2,}/[0-9]{3,}";
string replacement = "$3 $2 $1";
Regex rgx = new Regex(pattern);
string result = rgx.Replace(text, replacement);
richTextBox1.Text = result;
Please, help me to edit proper pattern format.
EDIT:
I just forget to write, that at first I am loading data from .txt file and in that data I am replacing date format 31/03/2015 or 1/03/02 to 2015 03 31.