Me and my colleague have different versions of VisualStudio. He used interpolated string and I couldn't build the solution and had to convert them all to string.Format.
Now I thought it might be good exercise for regex.
So how to convert this:
$"alpha: {alphaID}, betaValue: {beta.Value}"
To this:
string.Format("alpha: {0}, betaValue: {1}", alphaID, beta.Value)
Now the number of variables can vary (let's say 1 - 20, but should be generic)
I came up with this regex, to match the first variable
\$.*?{(\w+)}
but I couldn't figure out how to repeat the part after dollar sign, so I can repeat the result.
{{and}}literal braces? That is not the best job for a regex to parse code. Related: stackoverflow.com/questions/31648824/…string.Format($"alpha: {alphaID}, {0}, betaValue: {1} {beta.Value}", varOne, varTwo)be handled?