develooper Front page | perl.perl6.language.regex | Postings from August 2000

Re: RFC 110 (v3) counting matches

Thread Previous | Thread Next
From:
Jonathan Scott Duff
Date:
August 29, 2000 08:31
Subject:
Re: RFC 110 (v3) counting matches
Message ID:
20000829103837.B16323@cbi.tamucc.edu
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
duff@cbi.tamucc.edu

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About