lua-users home
lua-l archive

Pattern question

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


Hi experts,
can anybody explain the following:
 s = "/one/two/three"
 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 string.
This variant works as expected:
 print(s:match("/[^/]-$"))	--> /three
Regards,
Bernd
--
http://sudrala.de

AltStyle によって変換されたページ (->オリジナル) /