fork download
  1. function escape (s)
  2. return string.gsub(s, '[.*+?^$()[%%-]', "%%%0")
  3. end
  4. function pattern_matcher(v, pattern) return string.match(v, pattern) end
  5.  
  6. word = "u.meta"
  7. print(pattern_matcher("u.meta.something", '^' .. escape(word) .. '%f[%z.]')) -- u.meta
Success #stdin #stdout 0s 2788KB
stdin
Standard input is empty
stdout
u.meta