title: How can I escape characters (, ), [, ], *, _, with \ without changing link construction: []()
body: <p>I have the following text:</p>
  <pre class="lang-cs prettyprint-override"><code>input = &quot;text, *text*, text, text, (text), [text], [text](http://.....) *text*, text, text, (text), [text]&quot;
  </code></pre>
  <p>I'm trying to replace characters '_', '*', '[', ']', '(', ')' to '\_', '\*' etc.</p>
  <p>I'm writing:</p>
  <pre class="lang-cs prettyprint-override"><code>pattern = @&quot;(?&lt;!\[(?&lt;text&gt;.*)\]\((?&lt;url&gt;.*))([[\]\(\)*_])&quot;;
  
  input = Regex.Replace(input, pattern, @&quot;\$1&quot;);
  
  System output: &quot;text, \*text\*, text, text, \(text\), \[text\], \[some\_text with \_ \* \]\(http://.....) \*text\*, text, text, \(text\), \[text\]&quot;
  
  </code></pre>
  <p>How to make sure that the design of the link []() doesn't change? i.e. it would look like:</p>
  <pre class="lang-cs prettyprint-override"><code>desired output:&quot;text, \*text\*, text, text, \(text\), \[text\], [some\_text with \_ \*](http://.....) \*text\*, text, text, \(text\), \[text\]&quot;
  </code></pre>