[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Finding intermediate token in a string
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 7 Jul 2014 10:33:45 +0200
On Mon, Jul 7, 2014 at 9:18 AM, Austin Einter <austin.einter@gmail.com> wrote:
> Please note that, input string might have some data before or after of given
> example values.
How about something really simple?
local lens = input:match('^Content%-Length%s*:%s+(%d+)%s+$')
if lens then -- gotcha Content-length
len = tonumber(lens)
end
Note how '-' must be escaped...%s matches all whitespace, including line ends.