Re: extension to string.gmatch (structural regular expressions)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: extension to string.gmatch (structural regular expressions)
- From: Shmuel Zeigerman <shmuz@...>
- Date: 2008年1月01日 21:25:07 +0200
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