Hello Nick,

ND = Nick Danger 

On  Fri, 12 Jan 2001  at  21:01:57 GMT -0600 (which was 7:01 PM where
I live) witnesses say Nick Danger typed:

ND> I'll be waiting, and thanks for the explanation - I did find it
ND> enlightening even though I'm not sure I followed the entire
ND> "lesson".

I'm glad it was helpful. This is getting ugly, but this works pretty
well. Here is the full regexp in all it's gory detail:

<one line>
%SETPATTREGEXP="[/-](\d{4})$"%REGEXPBLINDMATCH="%DATESHORT"%SUBPATT="1"%SETPATTREGEXP="(\d{2})$"%REGEXPBLINDMATCH="%SETPATTREGEXP=""^(\d*)[/-]""%REGEXPBLINDMATCH=""%DATESHORT""0%SUBPATT=""1"""%SUBPATT="1"%SETPATTREGEXP="(\d{2})$"%REGEXPBLINDMATCH="%SETPATTREGEXP=""[/-](\d*)[/-]""%REGEXPBLINDMATCH=""%DATESHORT""0%SUBPATT=""1"""%SUBPATT="1"
</one line>

This assumes the date format is MM/DD/YYYY
The output is: 20010113

Now this huge regexp is really 3 separate regexps, each of those are
nested regexps.  Ok, so what does this mean?  I extract the year in
one regexp, the month in another, and the day in the final one. Insert
the following code block into a template:

--- Begin code block ---

%DATESHORT
 Year: %SETPATTREGEXP="[/-](\d{4})$"%REGEXPBLINDMATCH="%DATESHORT"%SUBPATT="1"
Month: 
%SETPATTREGEXP="(\d{2})$"%REGEXPBLINDMATCH="%SETPATTREGEXP=""^(\d*)[/-]""%REGEXPBLINDMATCH=""%DATESHORT""0%SUBPATT=""1"""%SUBPATT="1"
  Day: 
%SETPATTREGEXP="(\d{2})$"%REGEXPBLINDMATCH="%SETPATTREGEXP=""[/-](\d*)[/-]""%REGEXPBLINDMATCH=""%DATESHORT""0%SUBPATT=""1"""%SUBPATT="1"

---  End code block  ---

This block outputs:

--- Begin Output ---

1/13/2001
 Year: 2001
Month: 01
  Day: 13

---  End Output  ---

Of course if your date format is DD/MM/YYYY, you can paste these
regexps in the proper order to get the desired result.  The only real
restriction is that the year is in 4 digit format at the end of the
date.  Try it for different dates and see what happens.


-- 
Thanks for writing,
 Januk Aggarwal

 Using The Bat! 1.49
 under Windows 98 4.10 Build 2222  A 

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