2015-02-20 00:35:01 -05:00
|
|
|
test = "My name is Lua."
|
|
|
|
|
pattern = ".*name is (%a*).*"
|
2013-04-10 23:57:08 -07:00
|
|
|
|
2015-02-20 00:35:01 -05:00
|
|
|
if test:match(pattern) then
|
|
|
|
|
print("Name found.")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
sub, num_matches = test:gsub(pattern, "Hello, %1!")
|
|
|
|
|
print(sub)
|