Menu

#3 regex example fails

open
nobody
None
5
2014-07-13
2009-08-06
Anonymous
No

from the docu:
local ex = regexp(@"(\d+) ([a-zA-Z]+)(\p)");
local string = "stuff 123 Test;";
local res = ex.capture(string);
foreach(i,val in res)
{
print(format("match number[%02d] %s\n",
i,string.slice(val.begin,val.end))); //prints "Test"
}

...
will print
match number[00] 123 Test;
match number[01] 123
match number[02] Test
match number[03] ;

but in my test it outputs:

match number[00] 123 Test;
match number[01] 123
match number[02] Test
match number[03]

so the last output does not match.

Discussion


Log in to post a comment.