lua-users home
lua-l archive

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


On Fri, Apr 21, 2017 at 11:40 PM, Dirk Laurie wrote:
2017-04-21 10:09 GMT+02:00 steve donovan:

> I have a use case where it's important to guarantee that a lua string
> pattern is valid up front.

Is there such a thing as a pattern whose validity depends on what
string it is being applied to? If not, pcall(string.match, pattern, "")
should be adequate to test validity.


"(.)%2" is an invalid pattern, but it could be applied to empty string without an error.