lua-users home
lua-l archive

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


On 10/10/2017 10:43 PM, Soni L. wrote:
> However, I noticed something kinda weird:
> 
> string.match("''", "%f[']'", 2) --> nil
> string.match("''", "^'", 2) --> '

string.match("''", "%f[']'", 2). From position 2 of string [['']]
locate to index <i> such that s[i] ~= [[']] and s[i + 1] == [[']] and
s[i + 1] == [[']].

There is no such index so nil is returned. In case of string [['' ']]
there is match.

string.match("''", "^'", 2). From position 2 of string [['']] find
string [[']]. Do not skip characters (due "^" anchor). This matches
[[']], second apostrophe.

-- Martin