Thanks for all the contributions. You are a wonderfully helpful bunch! > -----Original Message----- > From: london [mailto:london] On Behalf Of [EMAIL PROTECTED] > Sent: Friday, October 11, 2002 3:29 PM > To: Uri Guttman > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [Boston.pm] Calling regex gurus ..A regex question.. > > > > > >>>>> "RN" == Ranga Nathan <[EMAIL PROTECTED]> writes: > > RN> This does not work. The \1, \2 etc are not evaluated as > > RN> 'iterators'. I tried the experimental ?{} too. > > well, if the count range is low, you could always > roll out each possible count in the regular expression. > > my $patt = '(s\ds\d)'; > > $var =~ > / > ( 01 $patt ) > | ( 02 $patt $patt ) > | ( 03 $patt $patt $patt ) > ... > / This is being done in the context of Any2XML, where the regex matches are supplied as attributes in a template written in XML. So the evaluation is to be the laziest possible. There are numerous solutions in a script context but where it is done somewhere else, Anthony's suggestion works. I did look at the ??{} but didn't get the idea that I could construct a regex right there!
BTW this requires a pragma use re 'eval'; Because the pragma is local to a package, I had to slip it into Any2XML. > > if you go beyond 99, then probably not, but if the max > count is low enough, you could do it that way. Any2xml recurs in such a way to simulate \G so it goes down to any depth (well until it hits the memory wall!) > > you did say speed wasn't important... > > Greg > _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm

