Does anyone have a better regex than

  (from|FROM)
.*[\\(\\[]([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})[\\]\\)]

for stripping the IP address from a Received header?

Basically, I've code that does:

   String[] relays = message.getHeader("Received");

   for (int i = 0; i < relays.length; i++)
     if (matcher.contains(relays[i], pattern))
     {
        String ip = matcher.getMatch().group(2));
        ...
     }

It works with all of the headers I have come across so far, but I'm just
checking.

Since I already have several matchers that want this information, I'm
thinking of making this a utility method, e.g.,

        public String[] getRelays(MimeMessage);

Alternatively, a natural place to hang this would be on
org.apache.mailet.Mail as

        public String[] getRelays();

but I am not going to change that interface without agreement!

        --- Noel


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to