I have text with this structure:
1. Text1
2. Text 2. It has a number with a dot.
3. 1. Text31
I want to get this text:
# Text1
# Text 2. It has a number with a dot. (notice that this number did not get replaced)
## Text31
I tried doing the following but it does not work
var pattern = @"^(\s*\d+\.\s*)+";
var replaced = Regex.Replace(str, pattern, "#", RegexOptions.Multiline);
Basically, it should start matching at the start of every line and replace every matched group with # symbol. Currently, if more than one group is matched, everything is replaced by a single # symbol. Pattern I am using is probably incorrect, can anyone come up with a solution?