I have an input line like "=== text === and === text ===", and I want to replace the wiki syntax with the corresponding html tag.
input:
===text=== and ===text===
desired conclusion:
<h1>text</h2> and <h1>text</h2>
but with the following code I get this output:
var regex = new Regex("---(.+)---"); var output = regex.Replace("===text=== and ===text===", "<h1>$1</h1>"); <h1>text=== and ===text</h1>
I know the problem is that my regex matches greedy. But how to make them not greedy.
Thanks and kindly. Danny
c # regex regex-greedy greedy
dannyyy
source share