Quiz question on string matching
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Quiz question on string matching
- From: Dirk Laurie <dirk.laurie@...>
- Date: 2016年1月29日 07:41:34 +0200
Find a pattern with no captures such that putting it in parentheses
may change what it matches.
More precisely:
Find strings `str` and `pat` such that `testanswer(str,pat)` prints
'true', where
testanswer = function(str,pat)
if pat:match"[()]" then return end
print(str:match(pat) ~= str:match('(' .. pat .. ')'))
end