title: postfix pcre Regex to match and replace substring
body: <p>I'm using Postfix MTA and get important mails in from a broken MTA (which I can't fix because it's not under my control), which sends in the following format:</p>
  
  <pre><code>RCPT TO: &lt;+49 (681) 12345678&gt;
  </code></pre>
  
  <p>What I need is:</p>
  
  <pre><code>RCPT TO: 4968112345678
  </code></pre>
  
  <p>So I am looking for a regex, which first checks if the string begins with "RCPT TO:" and if this is true, it needs to remove all special characters after it, so that only [a-zA-Z0-9] are left.</p>
  
  <p>Postfix ships an example for such regex'es:</p>
  
  <pre><code># Work around clients that send RCPT TO:&lt;'user@domain'&gt;.
  # WARNING: do not lose the parameters that follow the address.
  #/^RCPT\s+TO:\s*&lt;'([^[:space:]]+)'&gt;(.*)/     RCPT TO:&lt;$1&gt;$2
  </code></pre>
  
  <p>But after several hours I am unable to adapt it to my needs. </p>
  
  <p>Thanks in advance,
  Marco</p>