title: How to replace character at even position by ( and odd position by )
body: <p>Is it possible to write down a regular expression such that the first $ sign will be replaced by a (, the second with a ), the third with a (, etc ? </p>
  
  <p>For instance, the string </p>
  
  <pre><code>This is an $example$ of what I want, $ 1+1=2 $ and $ 2+2=4$. 
  </code></pre>
  
  <p>should become</p>
  
  <pre><code>This is an (example) of what I want, ( 1+1=2 ) and ( 2+2=4). 
  </code></pre>