10 lines
494 B
Lua
10 lines
494 B
Lua
assert(string.match("alo xyzK", "(%w+)K") == "xyz")
|
|
assert(string.match("254 K", "(%d*)K") == "")
|
|
assert(string.match("alo ", "(%w*)$") == "")
|
|
assert(string.match("alo ", "(%w+)$") == nil)
|
|
assert(string.find("(álo)", "%(á") == 1)
|
|
local a, b, c, d, e = string.match("âlo alo", "^(((.).).* (%w*))$")
|
|
assert(a == 'âlo alo' and b == 'âl' and c == 'â' and d == 'alo' and e == nil)
|
|
a, b, c, d = string.match('0123456789', '(.+(.?)())')
|
|
assert(a == '0123456789' and b == '' and c == 11 and d == nil)
|