lua-users home
lua-l archive

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

> Before this change, it was possible to traverse texts using
> string.find only and obtain everything: whole matches,
> captures and the pieces lying between the matches.
> To get this functionality with Lua 5.1, one should use
> 2 functions instead: string.find and string.match.
> Am I wrong?


You can use empty captures with string.match to know where you are.
string.match(s, "()pat()") is almost equivalent to string.find(s, "pat").
(Usually you can capture more useful and efficient positions.)

-- Roberto