I have such text:
((#) This is text
((#) This is subtext
((#) This is sub-subtext #)
#)
#)
I made following regex:
var counter = 0;
return Regex.Replace(text,
@"\(\(#\)(.*?)#\)",
m =>
{
var str = m.ToString();
counter++;
return counter + ") " + str.Replace("((#)", "").Replace("#)", "")
});
So the result I expected would be like
1) This is text
2) This is subtext
3) This is sub-subtext
I know that this will not work properly, because regex will take #) from the second ((#) and so on.
How to avoid this conflict? Thanks! :)