Hello Urke,
Historians believe that Wed, 27 Jun 2001 at 21:12 GMT +0200 was when,
Urke [U] typed the following:
U> Well, next step is to check if in header exist X-Mailer, then write to
U> message mail client name, if not exist, then write N/A, and I make this:
U> %SETPATTREGEXP="^.*(X\-Mailer)\:\s(.*?)\n.*"%-
U> %REGEXPBLINDMATCH="%HEADERS"%-
U> %IF:"%SUBPATT='1'"="X-Mailer":"%SUBPATT='2'":"N/A"
U> ...but, always I get N/A.
The nesting of the %SUBPATTERN is what is at fault. In the scope of
the %IF macro, the subpatterns are empty, thus no match. However,
there is a trivial way to get what you want. The trick is to
manipulate the input string. In other words, make your regexp look
like this:
%SETPATTREGEXP="(?im)^(X\-Mailer)\:\s(.*?)$"%-
%REGEXPBLINDMATCH="%HEADERS
X-Mailer: N/A"%-
%SUBPATTERN="2"
Note the linebreaks are intentional. I've also made a couple of minor
changes to your regexp.
First, I added the option to look at each line individually.
Then I removed the two extra ".*" since we don't need them.
Next, I changed the string in the Blind match so that there is an
extra line. The extra line simulates the X-mailer field in case the
real X-Mailer line is missing. This regexp will find the *first*
occurance of "X-Mailer: ...", so the default is only used when the
real one is missing.
--
Thanks for writing,
Januk Aggarwal
Using The Bat! 1.53bis under Windows 98 4.10 Build 2222 A
This page intentionally left unblank.
--
______________________________________________________
Archives : <http://tbtech.thebat.dutaint.com>
Moderators : <mailto:[EMAIL PROTECTED]>
Unsubscribe: <mailto:[EMAIL PROTECTED]>