Matching the file names doesn't replace the file name itself. You can still use the standard io
library to read the files:
for entry in lfs.dir(folder) do
if string.match(entry, pattern) ~= nil then
local file = io.open(entry, "r")
-- TODO: Read stuff from the file here.
file:close()
end
end