lua-users home
lua-l archive

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


Norman Ramsey wrote:
  > for before, match in stringx.gmatch('Hello world', 'l', true) do
      print(string.format('%q', before),
            match and string.format('%q', match) or match)
    end
  "He"    "l"
  ""      "l"
  "o wor" "l"
  "d"     nil


For what it worth, `split' function in Lrexlib produces exactly same output:

- for before, match in stringx.gmatch('Hello world', 'l', true) do
+ for before, match in rex.split('Hello world', 'l') do

"He"	"l"
""	"l"
"o wor"	"l"
"d"	nil

--
Shmuel