|
steve donovan wrote:
On Tue, May 26, 2009 at 7:32 PM, Javier Guerra <javier@guerrag.com> wrote:pattern matching will get you most of the work.= ('d:\\bono\\dog\\cat.txt'):match('(%a):(\\.+\\)([^%.]+)%.(.+)$')d \bono\dog\ cat txt Although accounting for _all_ the cases with one pattern is a bit of a bitch ;)
It's probably not practical to do all at one go, specially the filespec part. I think it would fail if the file has multiple dots, or if the file starts with a dot.
I would skip the hard work and copy the algorithm from something like the Apache Portable Runtime. :-)
-- Cheers, Kein-Hong Man (esq.) Kuala Lumpur, Malaysia