Possible match for (seemingly) invalid Lua-pattern

lua, lua-5.2, pattern-matching, string

Solution

"(%d%d)+" is a valid pattern. It matches for example "some 45+67 text" or "some 4567+ text" and captures "45" in the first case and "67" in the second.

Problem

I know that you can't repeat match groups in Lua. For example, if I wanted to match the two successive `"45"`'s, I can't do: ``` print(string.find("some 4545 text", "(%d%d)+")) ``` which will print `nil` (no match found). However, since `find(...)` doesn't report an error (for the invalid patterns `"%"` and `"(%d"` errors are produced), it leads me to believe the pattern `"(%d%d)+"` is a valid one. If `"(%d%d)+"` is a valid pattern, what does it match? And if it isn't, is there a particular reason no error is produced?

Original source