For a start, it is better not to use the word
for the name variable, since this is a library for working with strings. You block access to it.
In Lua there is no full regular expressions, because Lua was conceived as the most easy language. Instead, a so-called "pattern match". So
is not working. Just in most cases enough modifiers
+ - * ?
In your case will fit:
local str = "qw.erty" return str:match("([a-z][a-z])%.")
local str = "qw.erty" return str:match("(%l%l)%.")