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: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Ken Ray > Sent: Wednesday, September 11, 2002 10:03 PM > To: [EMAIL PROTECTED] > 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: [EMAIL PROTECTED] > Web Site: http://www.sonsothunder.com/ > > > ----- Original Message ----- > From: "Dominique" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > 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 > > [EMAIL PROTECTED] > > http://lists.runrev.com/mailman/listinfo/metacard > > > > _______________________________________________ > metacard mailing list > [EMAIL PROTECTED] > http://lists.runrev.com/mailman/listinfo/metacard > _______________________________________________ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
