lua-users home
lua-l archive

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


Am 29.01.2016 um 06:50 schröbte Paul K:
Find a pattern with no captures such that putting it in parentheses may change what it matches.

testanswer("abc", "^.")
testanswer("abc", ".$")

testanswer("abc", "")


Paul.

Philipp


On Thu, Jan 28, 2016 at 9:41 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
   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