Hello solid,
ss = solid snake
On Mon, 15 Jan 2001 at 19:16:24 GMT +0700 (which was 4:16 AM where
I live) witnesses say solid snake typed:
<snip>
>> It could probably be done using a series of cascading Quick Templates
>> and conditional regexps. However, this is somewhat daunting at the
>> moment.
ss> «------ cut by solid ------»
ss> Wow thank's...thank's..thank's..thank's..thank's.. *repeat until my
ss> pc blows*
No problem. Just be careful, wouldn't want that PC to explode too
soon. :)
<snip>
ss> and this my Data about the time, I use 24 date format
>From your other post, the %TIME macro returns the time in 12 hour
format. So we'll just convert these times to match.
ss> 00:00 until 04:00 the string is "Malam Malam"
This one is a bit harder because we're going from 12:00 AM to 3:59 AM.
We'll have to break it up into 12:00 AM to 12:59 AM, and 1:00 AM to
3:59 AM.
So we'll put one regexp for this one into a Quick Template called
"Greeting 1" (without quotes). The regexp would be (just cut and paste
for best effect):
<Greeting 1 QT>
%SETPATTREGEXP="(?i)(?(?=12\:[0-5][0-9]\sAM)12\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Malam
Malam;%QINCLUDE=""Greeting 2"""%SUBPATT="1"%SUBPATT="2"
</Greeting 1 QT>
For 1:00 AM to 3:59 AM, use QT "greeting 2"
<Greeting 2 QT>
%SETPATTREGEXP="(?i)(?(?=0?[0-3]\:[0-5][0-9]\sAM)0?[0-3]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Malam
Malam;%QINCLUDE=""Greeting 3"""%SUBPATT="1"%SUBPATT="2"
</Greeting 2 QT>
ss> 04:01 until 05:00 the string is "Subuh"
We'll change this to 4:00 AM to 4:59 AM. Put it in "Greeting 3"
<Greeting 3 QT>
%SETPATTREGEXP="(?i)(?(?=0?[4]\:[0-5][0-9]\sAM)0?[4]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Subuh;%QINCLUDE=""Greeting
4"""%SUBPATT="1"%SUBPATT="2"
</Greeting 3 QT>
ss> 05:01 until 07:00 the string is "Waktu Ayam berkokok"
Again, just shift this to 5:00 AM to 6:59 AM, and put it in "Greeting 4"
<Greeting 4 QT>
%SETPATTREGEXP="(?i)(?(?=0?[5-6]\:[0-5][0-9]\sAM)0?[5-6]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Waktu
Ayam berkokok;%QINCLUDE=""Greeting 5"""%SUBPATT="1"%SUBPATT="2"
</Greeting 4 QT>
ss> 07:01 until 09:00 the string is "Pagi"
I think you're starting to get the idea.
<Greeting 5 QT>
%SETPATTREGEXP="(?i)(?(?=0?[7-8]\:[0-5][0-9]\sAM)0?[7-8]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Pagi;%QINCLUDE=""Greeting
6"""%SUBPATT="1"%SUBPATT="2"
</Greeting 5 QT>
ss> 09:01 until 12:00 the string is "Pagi agak siang"
This one is a bit tough again, so do 9:00 to 9:59 in "Greeting 6"
<Greeting 6 QT>
%SETPATTREGEXP="(?i)(?(?=0?[9]\:[0-5][0-9]\sAM)0?[9]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Pagi
agak siang;%QINCLUDE=""Greeting 7"""%SUBPATT="1"%SUBPATT="2"
</Greeting 6 QT>
Now 10:00 AM to 11:59 AM in "Greeting 7"
<Greeting 7 QT>
%SETPATTREGEXP="(?i)(?(?=1[0-1]\:[0-5][0-9]\sAM)1[0-1]\:[0-5][0-9]\sAM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Pagi
agak siang;%QINCLUDE=""Greeting 8"""%SUBPATT="1"%SUBPATT="2"
</Greeting 7 QT>
ss> 12:01 until 15:00 the string is "Siang"
Another slightly tricky one. Ok, go from 12:00 PM to 12:59 PM in
Greeting 8
<Greeting 8 QT>
%SETPATTREGEXP="(?i)(?(?=1[2]\:[0-5][0-9]\sPM)1[2]\:[0-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Siang;%QINCLUDE=""Greeting
9"""%SUBPATT="1"%SUBPATT="2"
</Greeting 8 QT>
Now from 1:00 PM to 2:59 PM in Greeting 9,
<Greeting 9 QT>
%SETPATTREGEXP="(?i)(?(?=0?[1-3]\:[0-5][0-9]\sPM)0?[1-3]\:[0-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Siang;%QINCLUDE=""Greeting
10"""%SUBPATT="1"%SUBPATT="2"
</Greeting 9 QT>
ss> 15:01 until 17:30 the string is "Sore"
Ah, you're throwing me a curveball here. Ok, we'll need to break this
one up into 3:00 PM to 4:59 PM in Greeting 10
<Greeting 10 QT>
%SETPATTREGEXP="(?i)(?(?=0?[3-4]\:[0-5][0-9]\sPM)0?[3-4]\:[0-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Sore;%QINCLUDE=""Greeting
11"""%SUBPATT="1"%SUBPATT="2"
</Greeting 10 QT>
And from 5:00 PM to 5:29 PM in Greeting 11
<Greeting 11 QT>
%SETPATTREGEXP="(?i)(?(?=0?[5]\:[0-2][0-9]\sPM)0?[5]\:[0-2][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Sore;%QINCLUDE=""Greeting
12"""%SUBPATT="1"%SUBPATT="2"
</Greeting 11 QT>
ss> 17:31 until 18:00 the string is "Maghrib"
Another curveball, ok, only need one for 5:30 to 5:59 PM in Greeting 12
<Greeting 12 QT>
%SETPATTREGEXP="(?i)(?(?=0?[5]\:[3-5][0-9]\sPM)0?[5]\:[3-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;Maghrib;%QINCLUDE=""Greeting
13"""%SUBPATT="1"%SUBPATT="2"
</Greeting 12 QT>
ss> 18:01 until 21:00 the string is "waktu nonton film"
Back to the easy ones. So from 6:00 PM to 8:59 PM in Greeting 13,
I'm also going to cheat a little and take advantage of the fact that
we have looked for all time intervals except the final two. So this
is only one regexp that will look for both.
<Greeting 13 QT>
%SETPATTREGEXP="(?i)(?(?=0?[6-8]\:[0-5][0-9]\sPM)0?[6-8]\:[0-5][0-9]\sPM;(.*?);|.*;.*?;(.*))"%REGEXPBLINDMATCH="%TIME;waktu
nonton film;waktu orang pada tidur"%SUBPATT="1"%SUBPATT="2"
</Greeting 13 QT>
ss> 21:01 until 23:59 the string is "waktu orang pada tidur"
This one was taken care of in Greeting 13.
ss> I'm sorry if a lot, but it's nice if it's documented in website or
ss> other..
You have 13 Quick Templates to create before this will work. Your
best bet is to use COPY (CTRL-C) and PASTE (CTRL-V) to put the regexps
into your quick templates. Be very careful not to create infinite
loops with all the %QINCLUDE="..." macros that we've used.
--
Thanks for writing,
Januk Aggarwal
Using The Bat! 1.49c under Windows 98 4.10 Build 2222 A
Ok, who is General Relativity, and what did he do with Sir Newton?
--
--------------------------------------------------------------
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 : [email protected]