regex issue

Jay Norwood jayn at prismnet.com
Mon Mar 19 05:59:06 PDT 2012


On Monday, 19 March 2012 at 08:14:18 UTC, Dmitry Olshansky wrote:
> On 19.03.2012 12:05, Dmitry Olshansky wrote:
>>
>> In that case, I should have been able to do something like:
>>>
>>> matches=match(input,ctr);
>>> l_cnt = matches.length();
>
> I'm curious what this length() does as I have no length for 
> RegexMatch in the API :)
>
>>>
>>> But I only get length=1, and so I'm a bit concerned that 
>>> greedy is not
>>> really working. In fact, it is about 3x faster to just run 
>>> the second
>>> piece of code, so I think something must be wrong...

http://dlang.org/phobos/std_regex.html#length

Yes, I should have typed matches.captures.length.  It is  always 
returning 1, even though the desciption indicates the "g" flag 
should create a match object that contains all the submatches.



More information about the Digitalmars-d-learn mailing list