On Thu, Sep 18, 2008 at 06:11:45PM +0800, Chris Davaz wrote: : I'm trying to pin down what $string.match(/pat/) should be returning. : : >From S05: : : Under "Return values from match objects" : "A match always returns a Match object..." : : >From S29: : : Under the definition of Str.comb : : Saying : : $string.comb(/pat/, $n) : : is equivalent to : : $string.match(rx:global:x(0..$n):c/pat/) : : [ ...and later... ] : : "If there are captures in the pattern, a list of Match objects (one : per match) is returned instead of strings." : : Which implies that $string.match(/pat/) should indeed return a List of : Str and $string.match(/pat_with_groups/) should return a List of : Match. : : I expected the S29 definition when first approaching $string.match I : feel it is more intuitive than what happens with S05. Could someone : clarify what the behavior should be?
S05 is using a different definition of "match". In S05 it means more like "one low-level run of the regex engine" rather than "one high-level call to the .match method". In other words, the .match method can do multiple matches. Larry