Stack Directory?

Ken Ray kray at sonsothunder.com
Thu Sep 12 00:31:01 EDT 2002


Honestly, I don't know about speed... it all looks blazing to me. :-) I know
Richard's got a benchmark app; perhaps someone could run this and report to
the list?

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/

----- Original Message -----
From: "Chipp Walters" <chipp at chipp.com>
To: <metacard at lists.runrev.com>
Sent: Wednesday, September 11, 2002 10:42 PM
Subject: RE: Stack Directory?


> Wow, Great work Ken. Thanks a lot. Can't wait for the tutorial!
>
> Can you tell me how fast regular expressions are?
> Would you think it faster than:
>
> function AppPath
>    set itemdel to tab
>    put the effective filename of this stack into tStack
>    put last item of tStack into tFile
>    return tFile
> end AppPath
>
> and why do you do the local tPath...is it faster for MC if you declare
local
> variables?
>
> thx again,
>
> chipp
>
> > -----Original Message-----
> > From: metacard-admin at lists.runrev.com
> > [mailto:metacard-admin at lists.runrev.com]On Behalf Of Ken Ray
> > Sent: Wednesday, September 11, 2002 10:03 PM
> > To: metacard at lists.runrev.com
> > Subject: Re: Stack Directory?
> >
> >
> > Actually, with MC 2.4.2 and above, you can use regular expressions
(yeah,
> > it's the RegEx guy again... ;-) to do this:
> >
> > function AppPath
> >   local tPath
> >   get matchText(the effective fileName of this stack,"(.*\/)",tPath)
> >   return tPath
> > end AppPath
> >
> > For those of you trying to pick up RegEx, the code here:
> >
> >   (.*\/)
> >
> > Means this:
> >
> >   .* => Match all characters starting from the first character of
> > the string
> > (the effective filename of this stack)...
> >
> >   \/  => ... until you match a '/' (the '\' is to 'escape' the forward
> > slash), and then keep going until you match the last '/' in the string.
> >
> >   ( )  => ... and return what you found in the first variable supplied
to
> > the matchText function (tPath).
> >
> > The key here is that .* is a "greedy match", which means it will match
> > everything until the *last* match of the forward slash. If you use .*?,
it
> > will only go to the first match of the forward slash (which would
> > return the
> > volume the stack was on).
> >
> > Examples:
> >
> > If "the effective filename of this stack" is
> > "C:/Development/MyStuff/MyProject.mc", then:
> >
> > using (.*\/) would return:
> >
> >    C:/Development/MyStuff/
> >
> > and using (.*?\/) would return:
> >
> >    C:/
> >
> > Yes, yes, I know... I'm still working on putting together a RegEx
> > tutorial... :-)
> >
> > Ken Ray
> > Sons of Thunder Software
> > Email: kray at sonsothunder.com
> > Web Site: http://www.sonsothunder.com/
> >
> >
> > ----- Original Message -----
> > From: "Dominique" <mcdomi at free.fr>
> > To: <metacard at lists.runrev.com>
> > Sent: Wednesday, September 11, 2002 3:00 PM
> > Subject: Re: Stack Directory?
> >
> >
> > > >  function AppPath
> > > >    put the filename of <mainstackName> into tPath
> > > >    set the delimiter to "/"
> > > >    delete last item of tPath
> > > >    return tPath &"/"
> > > >  end AppPath
> > >
> > > Beautiful :-)
> > >
> > >
> > > --
> > > Regards,
> > > (-8 Dominique
> > > _______________________________________________
> > > metacard mailing list
> > > metacard at lists.runrev.com
> > > http://lists.runrev.com/mailman/listinfo/metacard
> > >
> >
> > _______________________________________________
> > metacard mailing list
> > metacard at lists.runrev.com
> > http://lists.runrev.com/mailman/listinfo/metacard
> >
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>




More information about the metacard mailing list