lua-users home
lua-l archive

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


Chris Datfung wrote:
I've read through the lrexlib doco, but can't seem to get Lua to parse a
string and capture text. For example in the string:

<myMarker>captureMe</myMarker>

I want to get the string 'captureMe'.

For example:

-- With Lrexlib/PCRE:
local rex = require "rex_pcre"
local c = rex.match(text, "<myMarker>(.*?)</myMarker>")

-- or with Lua string library:
local c = string.match(text, "<myMarker>(.-)</myMarker>")

--
Shmuel