title: Regular Expression for extracting text from an RTF string
body: <p>I was looking for a way to remove text from and RTF string and I found the following regex:</p>
  
  <pre><code>({\\)(.+?)(})|(\\)(.+?)(\b)
  </code></pre>
  
  <p>However the resulting string has two right angle brackets "}"</p>
  
  <p><strong>Before:</strong> <code>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS Shell Dlg 2;}{\f1\fnil MS Shell Dlg 2;}} {\colortbl ;\red0\green0\blue0;} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\tx720\cf1\f0\fs20 can u send me info for the call pls\f1\par }</code></p>
  
  <p><strong>After:</strong> <code>}   can u send me info for the call pls }</code></p>
  
  <p>Any thoughts on how to improve the regex?</p>
  
  <p><strong>Edit:</strong>  A more complicated string such as this one does not work:  <code>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS Shell Dlg 2;}}  {\colortbl ;\red0\green0\blue0;}  {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\tx720\cf1\f0\fs20 HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\test\\myapp\\Apps\\\{3423234-283B-43d2-BCE6-A324B84CC70E\}\par  }</code></p>