?
matches an optional character, i.e, zero or one occurrence of a character. So the pattern "("?)
matches a "
, followed by an optional "
, i.e, it matches either "
or ""
. Note that the match for "?
(zero or one "
) is captured.
As for the return value of string.find()
, from string.find()
:
If the pattern has captures, then in a successful match the captured values are also returned, after the two indices.
The capture is the third return value, when there is a successful match.