Marck D Pearlstone wrote:

> @24-Oct-2003, 19:14 -0700 (01-Nov 02:14 UK time) George Mitchell
> said to TBUDL:

I didn't realize you guys were a week ahead of us!  ;-)

> ... <snip>
>> %SETPATTREGEXP="(?i)[EMAIL PROTECTED]"%-
>> %_TO_ADDR=%REGEXPMATCH="'%OTOLIST, %OCCLIST'"%-
>> %IF:%_TO_ADDR<>"":"%FROM=''%FROM='%_TO_ADDR'":""%-

> ... <snip>

> The quote matching looks a bit dubious to me here. Particularly in
> the IF statement where (CMIIW) the quoting for the clauses needs to
> be established in the conditions and in the REGEXPMATCH where there
> are literal single quotes being included in the string - although
> they will just be ignored for matching purposes. It could all be
> affecting the logic of the macros though. The '-' in the character
> class must be escaped. Here's what it should really be.

> %SETPATTREGEXP="(?i)[EMAIL PROTECTED]"%-
> %_TO_ADDR='%REGEXPMATCH="%OTOLIST, %OCCLIST"'%-
> %IF:"%_TO_ADDR"<>"":"%FROM=''%FROM='%_TO_ADDR'":""%-

My template actually uses the new macro syntax.  I tried to convert it
to the old syntax in case folks wanted try it.  I guess I botched it a
bit, though I'm pretty sure I tested it some before posting.  What I'm
actually using is:

%SETPATTREGEXP("(?i)[EMAIL PROTECTED]")%-
%_TO_ADDR="%REGEXPMATCH('%OTOLIST, %OCCLIST')"%-
%IF:%_TO_ADDR<>"":"%FROM=''%FROM='<%_TO_ADDR>'":""%-

Per your suggestion I've added double-quotes to the first part of the
IF conditional.  Regarding the '-' in the character class, TB!'s help
file (and my limited experience with various RegEx implementations)
indicates it's OK unescaped at the beginning or end of the class.  It
is perhaps clearer to escape it though.

>> Is there a way I can have TB! automatically remove the new
>> contents of the From field instead of the default?

> Only with a recursive macro. That may need some TBTECH input to get
> it right.

I may give it a try.  At this point what I have works pretty well.
The only problem is with "reply to all", and the worst that happens
is that I CC myself.  Getting it just right would be pretty much for
fun & experience (I do enjoy this stuff).  I will take further
questions on this to TBTECH.

Thanks for your help on this.

-- 
George

Using TB! 2.01.20 on Windows XP Pro 5.1, Build 2600, Service Pack 1.


________________________________________________
Current version is 2.01.3 | "Using TBUDL" information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to