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 11:21:30AM -0400, Joe McMahon wrote:
> This is NOT completely thought out yet; I've been mulling it over as a 
> possible RFC. I'm not happy with this syntax as it stands - there's too 
> much possible action at a distance. I'm not seeing a nicely-parseable, 
> easily-understandable way of doing this. Would this be a possible:
> 
>    $string =~ /(\d\d)-(\d\d)-(\d\d)?&{push @list,makedate(\1,\2,\3)}/g;
> 
> Or is that just too ugly and nasty for words?

How about something like this?

	$re = qr/(\d\d)-(\d\d)-(\d\d)/g;
	$re->onmatch_callback(push @list, makedate(^0,^1,^2));
	$string =~ $re;

-Scott
-- 
Jonathan Scott Duff
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.