I have the following text:
input = "text, *text*, text, text, (text), [text], [text](http://.....) *text*, text, text, (text), [text]"
I'm trying to replace characters '_', '*', '[', ']', '(', ')' to '\_', '\*' etc.
I'm writing:
pattern = @"(?<!\[(?<text>.*)\]\((?<url>.*))([[\]\(\)*_])";
input = Regex.Replace(input, pattern, @"\$1");
System output: "text, \*text\*, text, text, \(text\), \[text\], \[some\_text with \_ \* \]\(http://.....) \*text\*, text, text, \(text\), \[text\]"
How to make sure that the design of the link []() doesn't change? i.e. it would look like:
desired output:"text, \*text\*, text, text, \(text\), \[text\], [some\_text with \_ \*](http://.....) \*text\*, text, text, \(text\), \[text\]"