I tried the following regex replacement:
Regex.Replace("one, two, three, ", ",([.*?]),\s$", ", and$1.");
Which returns
"one, and two, three."
Looking for:
"one, two, and three."
I have a regex that can do this. I don't need help there.
My question: Doesn't the lazily quantified .*? mean it will match as few as possible? If it did (obviously it didn't), it would stop matching at the comma after "two". Does it instead find the first match possible starting from the start of the string?
Update:
first line should read:
Regex.Replace("one, two, three, ", ",(.*?),\s$", ", and$1.");