lua-users home
lua-l archive

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


> How can I match all possible EndOfLines in strfind() with a Lua pattern?

One possible solution is to preprocess the string:

  s = gsub(s, "\r?\n\r?", "\n")

Now, you can just look for "[\n\r]". (The previous `gsub' assumes that
the string is "reasonably" consistent. It fails if you have an empty
line like "hello\r\n\rhi".)

-- Roberto