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

Hi Victor,

@1-Jan-2003, 11:13 -0500 (16:13 UK time) Victor B. Gonzalez said:

> OK, I've been told to go to the TB! faqs to learn more and I am
> sorry to say its useless for me :( I believe theirs either an
> assumption that I already know RegEx and I should only use all
> learning materials as a reference or someone thinks it's really
> easy which makes me feel really stupid.

I think you may have missed the link to the RegEx tutorial. It's a
step by step, from the basics up.

http://www.silverstones.com/thebat/RegEx.html

> I would like to de-compile the above macros because I too need
> them in a sense and I would surely be happy if any one could help
> with some words of wisdom :)

> %RegExpText="(?im-s)^\s*friends_name:\s*(.*?)\s*\n"%-
> %RegExpText="(?im-s)^\s*friends_email:\s*(.*?)\s*\n"%-
> %RegExpText="(?im-s)^\s*your_name:\s*(.*?)\s*\n"%-
> ^^^^^^^^^^^^^^^^^^^^^^^^         ^^^^^^^^^^^^^^^^^

> I noticed from what I underlined that their is a lot of recycled
> code in those lines. The mission of the macros is to extract data
> from the *body*?

Yes. The %RegExpText keyword means "Use regular expressions to
extract data from the message *text*".

> OK, Lets say then the whole purpose of the macros is to extract
> data from the body. If I have a line of data that looks like the
> below line:

> friends name: Victor B. Gonzalez
>        ^            ^  ^
> friends name:       Victor B. Gonzalez
>        ^     ^^^^^^^      ^  ^
>
> Do the spaces I underlined screw things up? OK, Lets pretend
> that they don't for simplicity sake.

They don't.

> What does what I underlined mean with the following?
>
> %RegExpText="(?im-s)^\s*your_name:\s*(.*?)\s*\n"%-
>              ^^^^^^^^^^^          ^^^^^^^^^^^^^ ^^

%RegExpText="
(?im-s)    is a section dealing with the setting of Regular
           expression Internal options : 'i' = case insensitive, 'm'
           = multi-line and '-s' = exclude newlines ... '-' turns
           the 's' (include new lines) option off
^          Start of line
\s*        any number of white-space characters
your_name: a literal string
\s*        any number of white-space characters
(.*?)      A recorded pattern consisting of any character (the
           target for the extraction. Final '?' means "may or may
           not be present".
\s*        any number of white-space characters
\n         A newline character
"%-

> What if I got a form with three e-mail addresses on it but it was
> formatted like the following:

> email 1:         [EMAIL PROTECTED]
> email 2:         [EMAIL PROTECTED]
> email 3:         [EMAIL PROTECTED]

> Can I get that single message to turn around and email three
> people? In other words three emails are shot out individually
> leaving the recipients with only their name in the to: field.

That one I'm not so sure about. Actually, I'm pretty sure you can't
do it how you're thinking of it. You could use a recursive macro,
but the language is not a scripting language. It's a template
definition language used during the process of constructing a single
message. You can always blank the "To" field and put all addresses
in the BCC of the message but you can't loop it round to create
off-shoot messages. CMIW but I think that's about the size of it.

> I know its complex so lets start small. How does the below line of
> code work? Would someone be so kind to break it apart and reveal
> the truth?

> %RegExpText="(?im-s)^\s*your_name:\s*(.*?)\s*\n"%-

It should extract any name in a line containing "your_name:". It
will ignore any enclosing white spaces and work equally well on:

your_name:Fred Flintstone

as on

                your_name:             Fred Flintstone

Trailing spaces are also removed.

> I just want to learn what works... Please, I need help.

Do read that tutorial - it's very good.

- --
Cheers -- .\\arck D Pearlstone -- List moderator
TB! v1.62 Christmas Edition on Windows 2000 5.0.2195 Service Pack 2
'
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1rc1-nr1 (Windows 2000)

iD8DBQE+Ex++OeQkq5KdzaARAmWlAKDxIaCUahznEv+4OJnQ8NYM1K6W0gCeKvoq
z0J8E/mVC/SR9tOEG2mPis4=
=zFOH
-----END PGP SIGNATURE-----



________________________________________________________
 Current version is 1.61 | "Using TBTECH" information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to