title: RegEx match IP on Mail-Header Received:
body: <p>I try to fiddle a RegEx, which returns me only the Sender IP Address:</p>
  
  <p><a href="http://regexr.com?38atl" rel="nofollow">http://regexr.com?38atl</a></p>
  
  <p>This is the RegEx I build, but cant complete:</p>
  
  <pre><code>(?&lt;=\bReceived: from .*\[)(?:\d{1,3}\.){3}\d{1,3}
  </code></pre>
  
  <p>or</p>
  
  <pre><code>(?&lt;=\bReceived: from )(.*\[)(?:\d{1,3}\.){3}\d{1,3}
  </code></pre>
  
  <p>So it should only match this (on lines beginning with: Received: from)</p>
  
  <pre><code>127.0.0.1
  127.0.0.1
  21.22.23.24
  </code></pre>
  
  <p>And this are a example Mail-Headers i'm search in:</p>
  
  <pre><code>To: a@domain.de
  Return-Path: &lt;t@domain.de&gt;
  X-Original-To: a@domain.de
  Delivered-To: c@domain.tld
  Received: from localhost (localhost [127.0.0.1])
          by mail1.domain.tld (Postfix) with ESMTP id 3fT3TR72zNz8m8
          for &lt;a@domain.de&gt;; Tue, 18 Feb 2014 14:54:35 +0100 (CET)
  X-Virus-Scanned: Debian amavisd-new at mail1.domain.tld
  X-Spam-Flag: YES
  X-Spam-Score: 5.773
  X-Spam-Level: *****
  X-Spam-Status: Yes, score=5.773 tagged_above=1 required=4.5
          tests=[BAYES_05=-0.5, MISSING_MID=0.497, RCVD_IN_PBL=3.335,
          RCVD_IN_RP_RNBL=1.31, RDNS_DYNAMIC=0.982, TO_NO_BRKTS_DYNIP=0.139,
          T_RCVD_IN_SEMBLACK=0.01] autolearn=no
  Received: from mail1.domain.tld ([127.0.0.1])
          by localhost (mail1.domain.tld [127.0.0.1]) (amavisd-new, port 10024)
          with ESMTP id lDJqiZjBn2t4 for &lt;a@domain.de&gt;;
          Tue, 18 Feb 2014 14:54:34 +0100 (CET)
  Received: from mail.domain.tld (pAAAAAAAA.dip0.t-ipconnect.de [21.22.23.24])
          by mail1.domain.tld (Postfix) with SMTP id 3fT3TQ4Nwgz8m5
          for &lt;a@domain.de&gt;; Tue, 18 Feb 2014 14:54:34 +0100 (CET)
  Date: Tue, 18 Feb 2014 15:02:11 +0100
  Sender: "From" &lt;t@domain.de&gt;
  From: "From" &lt;t@domain.de&gt;
  Subject: Subbbb (192.168.123.123)
  Reply-To: t@domain.de
  MIME-Version: 1.0
  Content-type: text/plain; charset=UTF-8
  Message-Id: &lt;3fT3TR72zNz8m8@mail1.domain.tld&gt;
  </code></pre>