lua-users home
lua-l archive

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


>>>>> "albertmcchan" == albertmcchan  <albertmcchan@yahoo.com> writes:

 albertmcchan> just curious, what will lpeg re pattern look like ?

This version is given as an example in the re docs:

record = re.compile[[
  record <- {| field (',' field)* |} (%nl / !.)
  field <- escaped / nonescaped
  nonescaped <- { [^,"%nl]* }
  escaped <- '"' {~ ([^"] / '""' -> '"')* ~} '"'
]]

though of course this processes only one record at a time (and assumes
that newline conversion has already been done; the RFC's definition is
for use in MIME bodies with canonical CRLF newlines).

-- 
Andrew.