lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


this version "remove" all a's, and match only 'nd':

pat = re.compile ([[
  line <- match_and+ -> drop3 {.*}
  match_and <- remove_a match_nd
  remove_a <- [^a]* . 'a'*
  match_nd <- 'nd' / . match_and
  ]], { drop3 = function(s) return string.sub(s, 1, -4) end } 
)

I tried building the same re pattern without recursive grammar, but failed.