-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 27 Oct 2000 16:01:06 -0400, Jan Rifkinson wrote these
comments about 'using meta characters & expressions':

JR> Yes it does. Now if I could just figure it out for myself. I printed
JR> out all the materials in the help file & have been ready diligently
JR> but I haven't figured out a simple way to test my attempts. Again,
JR> many thanks.

As you can see above, I've adopted this macro. :-)

Anyway, let me give you the basic structure of what is happening with
the regex macro. The first component of the regex macro is:

%setpattregexp="<regex>"

What this does is instruct TB! to use the given regular expression
(regex) to match a text variable. The text variable is defined by the
%regexblindmatch macro. In this case it's %regexblindmatch="%OSubj",
where %OSubj is the original message subject.

So so far, I've told TB! to attempt a given regex match on the messages
original subject.

Now look again at %Regexblindmatch.
                        ^^^^^
                        that little 'blind' part means that TB!
                        shouldn't output the match found until further
                        instructed.

So, to further summarize what's happening; I've instructed TB! to attempt
a given regex match on the messages original subject, but to do so
blindly, i.e., do not output it. If I wanted TB! to output the match right
away, I'd use the %regexmatch macro instead.


Now, for the subpattern part. To understand this, I'll now have to go
through the regular expression itself. It actually matches any message
subject.

(?i)\A\:?(\s*\[.*\])?(\s*(re|ha|rcpt|fwd)(\[\d*\])?:\s*)*(.*)
        ^^^^^^^^^^^^^
        this is my addition to a regex I was using that was created by
        Alexander Kiselev. It actually matches a '[' followed by any
        number of any characters followed by a ']' ... if they happen to
        be there.

(?i)\A\:?(\s*\[.*\])?(\s*(re|ha|rcpt|fwd)(\[\d*\])?:\s*)*(.*)
                     ^^^^^^^^^^^^^^^^^^^^
                     This matches any single or combination of 'Re:''s,
                     Fwd's etc that may precede the subject.

(?i)\A\:?(\s*\[.*\])?(\s*(re|ha|rcpt|fwd)(\[\d*\])?:\s*)*(.*)
                                         ^^^^^^^^^^
                                         This matches the number
                                         generated after the Re: by TB!
                                         if it appears.

and finally

(?i)\A\:?(\s*\[.*\])?(\s*(re|ha|rcpt|fwd)(\[\d*\])?:\s*)*(.*)
                                                         ^^^^
                                                         This matches
                                                         the subject
                                                         that you wish
                                                         for. :-)

Confused yet? I hope not. :-)

Anyway .... (.*) is a subpattern of the complete regular expression,
each subpattern being enclosed in it's own brackets. If you count
sequentially, from left to right, the appearances of '(', you'll see
that it's the fifth subpattern. When doing this ignore the initial (?i)
because that part isn't really a subpattern. '(.*)' is actually the
fifth subpattern in the entire regular expression.

Hence the last part of the macro '%subpattern="5".

So the grand total is:

Match the given regex to the original message subject, and output the
match for the 5th subpattern, which in this case is the subject without
all the preamble that may precede it.

Phew!! That wasn't so bad. I hope that helped.

Learning how to actually craft the regex is the part with a relatively
steep learning curve but once grasped it opens a new window of
opportunity once your applications support regex's.

- --
A. Curtis Martin..
Moderator TBUDL/TBBETA  |  PGP Key ID: 0xEE079937
PGP Key: mailto:[EMAIL PROTECTED]?Subject=SendAlliePGPKey
- ---
** "Warning: Politicians can be hazardous to your wealth. "
_____________________________________________________________
TB! v1.47 Halloween Edition (S/N CCA4F9B8) «» Win2k Pro SP1

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8
Comment: Digitally signed for sender verification.

iQA/AwUBOfo0FPAXeSHuB5k3EQIxxACdGVbSBapQI7PoFz+6/gDCn2fRlWUAn1mV
kNyYprogrzb7jU2HeAQs+HvX
=RXRZ
-----END PGP SIGNATURE-----

-- 
--------------------------------------------------------------
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   <mailto:[EMAIL PROTECTED]>
To Unsubscribe from TBUDL, double click here and send the message:
   <mailto:[EMAIL PROTECTED]>
--------------------------------------------------------------

You are subscribed as : archive@jab.org


Reply via email to