I have to match /home/user/file.lib
both in
bibliography: /home/user/file.lib
as well as
bibliography: "/home/user/file.lib"
in Lua.
The best I came up with is:
> s1 = "bibliography: /home/user/file.lib"
> s2 = 'bibliography: "/home/user/file.lib"'
> string.match(s1, 'bibliography: "?(%g+)"?')
/home/user/file.lib
> string.match(s2, 'bibliography: "?(%g+)"?')
/home/user/file.lib"
But the last match contain a trailing "
.
It looks like I need a non-greedy version of the +
operator, and it looks like Lua doesn’t have it.
How can I achieve my purpose?