title: Sublime Text - Regular Expression for search and replace
body: <p>I want to use search &amp; replace with a regular expression to turn the following text:</p>
  
  <p>"some text i dont care about <code>\cite[p. 6]{some-bibtex-citation}</code> some more text I care even less about \cite[p. 321 / 4]{and-another-citation-from-bibxtex} and still more text."</p>
  
  <p>into this: </p>
  
  <p>"some text i dont care about <code>[\citem{author}{some-bibtex-citation}, p. 6]</code> some more text I care even less about <code>[\citem{author}{and-another-citation-from-bibxtex}, p. 321 / 4]</code> and still more text."</p>
  
  <p>As you can see, all of the \cite occurences have been replaced with a different one. They are now surrounded by [ and ] and they all start with [citem{author}</p>
  
  <p>I tried it with the following search regex which basically works but can select too much text all at once:</p>
  
  <pre><code>\\cite\[(.+)\]\{(.+)\}
  </code></pre>
  
  <p>The replace regex I used for this is:   </p>
  
  <pre><code>[\\citem{author}{\2}, \1]
  </code></pre>