looks like it is not easy to convert lua pattern "(.*)and(.*)" after all my last attempt, re.compile "{(!'and' .)*} 'and' {.*}" was close, but still wrong the re pattern correspond to lua pattern "(.-)and(.*)", not the greedy version. :-(