Re: RFC 110 (v3) counting matches
[email protected] (Jonathan Scott Duff)
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Aug 29, 2000 at 09:23:59AM -0600, Tom Christiansen wrote:
> () = $string =~ m{
> (\d\d) - (\d\d) - (\d\d)
> (?{ push @dates, makedate($1,$2,$3) })
> }gx;
That empty list to force the proper context irks me. How about a
modifier to the RE that forces it (this would solve the "counting matches"
problem too).
$string =~ m{
(\d\d) - (\d\d) - (\d\d)
(?{ push @dates, makedate($1,$2,$3) })
}gxl;
$count = $string =~ m/foo/gl; # always list context
-Scott
--
Jonathan Scott Duff
[email protected]