I am trying to get a Regex replacement working to update my AssemblyInfo.cs files, so I have:
Regex.Replace(
contents,
@"(\[assembly: Assembly(File)?Version\("").*(""\)\])",
"$1" + version + "$3"
);
The problem is that version
is something like "1.5.3.0"
, so that when the replacement is evaluated it is seeing "$11.5.3.0$3"
and is presumably looking for the eleventh captured group because it is coming out with:
$11.5.3.0")]
If is stick a space after the $1
it works fine. What do I need to put in there to escape the second digit without actually inserting the character?