lua-users home
lua-l archive

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


> I want to parse a HTTP header string "name:value" pair. In REXX this
> is quite simple with the parse instruction, "parse var line name ":"
> value". In lua it seems much trickier using
> the example i have "local _, _, name, value = string.find(line,
> "^([^: ]+)%s*:%s*(.+)")". I understand that captures are much more
> powerful but what I want is to dumb them down so there
> is a lower entry level of skill required to do what is simple in
> REXX. Maybe it's possible to write a parse(line,"%s : %s:) function
> or something similar. It's most likely the case that I just don't
> know Lua string handling well enough to grok what is the best solution.

Maybe it is a "split" function what you need?

  http://en.wikipedia.org/wiki/String_manipulation_algorithm#split

-- Roberto