lua-users home
lua-l archive

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

On Tue, Apr 23, 2013 at 12:02 PM, Bernd Eggink <> wrote:
    print(s:match("/.-$"))   --> /one/two/three
Shouldn't the result be "/three"? To me it seems clear that "three" is the shortest character sequence between '/' and the end of the

Looks fine to me - remember . matches anything, and $ means end of string, so it's just doing what you asked it to!

If you said %a-, then yes it would work for this case.

The variant is the proper way to do it.