title: Improve performance of a regexp
body: <p>My software allows users to use regexp to prepare files. I am in the process of adding a default regexp library with common expressions that can be re-used to prepare a variety of formats. 
  One common task is to remove crlf in specific parts of the files, but not in others. For instance, this:</p>
  
  <pre><code>    &lt;TU&gt;Lorem 
      Ipsum&lt;/TU&gt;
      &lt;SOURCE&gt;This is a sentence
      that should not contain
      any line break.
      &lt;/SOURCE&gt;
  </code></pre>
  
  <p>Should become:</p>
  
  <pre><code>    &lt;TU&gt;Lorem 
      Ipsum&lt;/TU&gt;
      &lt;SOURCE&gt;This is a sentence that should not contain any line break.
      &lt;/SOURCE&gt;
  </code></pre>
  
  <p>I have a rexep that does the job pretty nicely:</p>
  
  <pre><code>(?(?&lt;=&lt;SOURCE&gt;(?:(?!&lt;/?SOURCE&gt;).)*)(\r\n))
  </code></pre>
  
  <p>The problem is that it is processing intensive and with files above 500kb, it can take 30+ seconds. (regex is compiled, in this case, uncompiled is much slower)</p>
  
  <p>It's not a big issue, but I wonder is there is a better way to achieve the same results with Regex. </p>
  
  <p>Thanks in advance for your suggestions.</p>