Hello Urke,
Historians believe that Wed, 27 Jun 2001 at 22:25 GMT +0200 was when,
Urke [U] typed the following:
JA>> %SETPATTREGEXP="(?im)^(X\-Mailer)\:\s(.*?)$"%-
JA>> %REGEXPBLINDMATCH="%HEADERS
JA>> X-Mailer: N/A"%-
JA>> %SUBPATTERN="2"
U> Hmmm, is there some typo errors?
I don't think so. Is it not working for you? If not, what results
are you getting?
U> I don't understand anything from this, or,
U> something I understand, but not all :-).
Ok, let me try to clarify. When you want search the headers, you use
%REGEXPBLINDMATCH="%HEADERS"
Now, what happens is, the macro %HEADERS is evaluated, ie the headers
are pasted in. You're making a mini-template inside the
%REGEXPBLINDMATCH macro. For this purpose, the template we want
would look like this:
<mini-template>
%HEADERS
X-Mailer: N/A
</mini-template>
The reason we want this particular template is because it will be
expanded to give something like:
<example>
Date: Wed, 27 Jun 2001 12:32:56 -0700
From: Januk Aggarwal <[EMAIL PROTECTED]>
X-Mailer: The Bat! (v1.53bis) Educational
Reply-To: Januk Aggarwal <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
To: Urke <[EMAIL PROTECTED]>
Subject: Re: Regex, headers and X-Mailer
In-Reply-To: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: N/A
</example>
In this example, there are two X-mailer lines. The regexp above will
only find the first one. But suppose you had a message with no
X-mailer field. The template gives you:
<example>
Date: Wed, 27 Jun 2001 12:32:56 -0700
From: Januk Aggarwal <[EMAIL PROTECTED]>
Reply-To: Januk Aggarwal <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
To: Urke <[EMAIL PROTECTED]>
Subject: Re: Regex, headers and X-Mailer
In-Reply-To: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: N/A
</example>
See how in this example, we only have one X-Mailer field? And this
one is the default value, "N/A". Now we don't have to worry about
an %IF statement, nor do we have to worry about a complicated regexp.
It's all taken care of automatically.
--
Thanks for writing,
Januk Aggarwal
Using The Bat! 1.53bis under Windows 98 4.10 Build 2222 A
Is it OK to use the AM radio after noon?
--
______________________________________________________
Archives : <http://tbtech.thebat.dutaint.com>
Moderators : <mailto:[EMAIL PROTECTED]>
Unsubscribe: <mailto:[EMAIL PROTECTED]>