[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: EndOfLine Pattern Matching
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 04 Apr 2002 09:41:24 -0300
> 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