let's say I have a source file that matches a certain filepattern, and I want certain elements of the file pattern to be reused in a newly created destination file.
so for ex. the specified file pattern given in regex is
src_pattern = "(\d\d)_(\d\d)_(\d\d\d\d)_FOO.xml";
after searching a directory, found a matching source file looking like
src = 08_21_2013_foo.xml
now the new file must be of the form
dst = $3$1$2_BAR.xml;
where the capturing groups pulled from the source (so would look like 20130821_BAR.xml). How would I go about accomplishing this efficienly, needs to pretty flexible and I have no knowledge of what each of these look like, they are being pulled from somewhere else. so I guess I'm having trouble with pulling the numberings for the capturing groups, ie the 3rd, the 1st, then the 2nd and let's say I found it, how do I reference it back to the source file. would I have to have an integer (say k) that represents the number and reference it like
match = Regex.Match(src, src_pattern)
match.Groups[k].Value
pulling these numberings seem to be a pain...
I also have no idea how many of these capturing groups each dst specifies so how to automate all of this? Is there another way or some smart native functonality for this