lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

steve donovan wrote:
On Tue, May 26, 2009 at 7:32 PM, Javier Guerra <> 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. :-)

Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia