Hi all,
 
Some have asked what regular expressions may be used for and I have
found a practical use for it. Alexander helped me with actually
constructing the regular expression and macros while I doodled,
rearranged things, experimented with the output and came up with the
final template entry.

                               THE HISTORY:

I've noted that the original message dates that are inserted in reply
templates using the %ODATE and %OTIME macros are the RFC headers
message creation date and time corrected to the recipients local time.
The original sender will therefore not see in the reply, the date and
time he sent the message, in his time zone. This can easily create
confusion especially since the GMT isn't inserted to indicate the
'conversion'. The working solution that I've been 'tolerating' is to
place my GMT of -5 in all reply templates. I still wanted to have
the original senders date and time with his/her time zone indicated.
This is the standard and correct way of doing it IMHO.


THE WORKAROUND:


I've noted that the original message date and time is always stated in
it's own line in the RFC headers with the following format:

Date: Day, Date and year, Time (24 hr format), GMT  <with occasional variations at
                                                     the end>
  
If I could extract that information using a regexp and place it in my
reply template it would provide a solution for me.


The REGULAR EXPRESSION (brace yourself folks):


(?m-s)Date\:\s*?((.*?[\d]{4})\s*?([\d]{0,2}\:[\d]{0,2}\:[\d]{0,2})\s*?(.*))

Alex says that it was simple to construct. I guess that's after you
*learn* how to do it. :)


THE TEMPLATE CONSTRUCT:


%SETPATTREGEXP="(?m-s)Date\:\s*?((.*?[\d]{4})\s*?([\d]{0,2}\:[\d]{0,2}\:[\d]{0,2})\s*?(.*))"

This tells the template the regexp to use.

"%REGEXPMATCH="%HEADERS"

These are macros used recursively, instructing that the RFC Headers
should be checked for matches for the set regular expression and the
result inserted where the macro is placed in the template


THE FINAL RESULT:


%SETPATTREGEXP="(?m-s)Date\:\s*?((.*?[\d]{4})\s*?([\d]{0,2}\:[\d]{0,2}\:[\d]{0,2})\s*?(.*))"%REGEXPMATCH="%HEADERS"

We'll designate that long line of text <CORRECTEDDATE macro> for clarity.

My reply template for this list now reads:

On <CORRECTEDDATE macro>, %FROMNAME wrote:

It's a looooong line of text but the end result is great. It has
worked flawlessly for me so far after checking it with messages from
many senders who use various e-mail clients.

Hope that helps.

-- 
Ali Martin                     |     Using The Bat! v1.38e 
 mailto:[EMAIL PROTECTED]      |     Windows NT 4.0 (Service Pack 6)  
   
   [ IBM: In Being Mended ]
____

-- 
--------------------------------------------------------------
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]>
--------------------------------------------------------------

Reply via email to