

Task

   match a string against a regular expression
   substitute part of a string using a regular expression


test = "My name is Lua."
pattern = ".*name is (%a*).*"
 
if test:match(pattern) then
    print("Name found.")
end
 
sub, num_matches = test:gsub(pattern, "Hello, %1!")
print(sub)