Hello Ralf,
Historians believe that Mon, 23 Apr 2001 at 21:42 GMT +0200 was when,
Ralf Buschmann [RB] typed the following:
RB> I'm trying to set up a regular expression in a reply template that will
RB> remove a certain prefix from an e-mail address ([EMAIL PROTECTED]).
RB> The address may be located in the From or To: or CC: header or in
RB> all/none of them.
<snip>
RB> and I use the "Reply" or "Reply to all" function, then the regular
RB> expression should always strip the leading "xxx." from
RB> [EMAIL PROTECTED], turning it into just [EMAIL PROTECTED]
I'm thinking you might be asking a bit much from a regular expression.
You could come up with some relatively limited regexps that could
handle parts of the task. Before I make an attempt, could you give
some more info please?
- What is the maximum number of recipients in any of these fields?
- Do you want to keep the person's name, ie:
"Ralf" <[EMAIL PROTECTED]>
becomes
"Ralf" <[EMAIL PROTECTED]>
- Are these addresses that need to be stripped from a limited number
of people? In other words, could you put them in your address book?
If you can put them in your address book, you might be able to get
away with using some of the %AB macros.
RB> Is this possible?
Unless you can put more restrictions on the scenarios, I don't think
it would be reasonable to do it with TB's regexps. But if you can
answer the above questions (and any other info you can think of),
that will help make the decision.
I think Perl would be a better tool for what you want. If you can get
someone to create an appropriate Perl script, we can help you get it
to work with TB to make something similar to what you want.
RB> I looked at the examples in the online help, but
RB> unfortunately regular expressions seem to be very difficult to
RB> understand
You need to break it down into small bits and see what they do. I
encourage you to look through the archives of this list in particular.
There are several threads that try to go through some examples in
great detail.
RB> and the help on regular expressions in general is lacking
Actually, the info in the help file is *very* good, but the learning
curve is a bit steep. There are lots of regexp books available for the
overall concept, and these lists are great for the TB-specific stuff.
RB> (what is %SUBPATT, %SETPATTREGEXP and %REGEXPBLINDMATCH, anyway?).
%SUBPATT="x" - is where the matched information is stored.
x runs from 0-99, IIRC.
%SETPATTREGEXP - This tells TB the pattern we're looking for.
%REGEXPBLINDMATCH - Telling TB what text to examine. Results are
stored in the subpatterns, and that's it.
%REGEXPMATCH - Same as above, but also returns Subpattern 1. If
Subpattern 1 is empty, returns Subpattern 0.
--
Thanks for writing,
Januk Aggarwal
Using The Bat! 1.51 under Windows 98 4.10 Build 2222 A
Have you ever imagined a world without hypothetical situations?
--
______________________________________________________
Archives : <http://tbtech.thebat.dutaint.com>
Moderators : <mailto:[EMAIL PROTECTED]>
Unsubscribe: <mailto:[EMAIL PROTECTED]>
You are subscribed as : [email protected]