\directlua{tex.print(string.match(“This is a string","%s%a$"))}
However, the %s%a are not working with the TeX-error “unfinished string near eof”. Obviously caused by the %’s.
How to get this working? \textpercent will not do, off course within Luacode.