in reply to Re: Can "delayed-regex assertions" be nested...
in thread Can "delayed-regex assertions" be nested...

Hi Moritz,

Thx for the feedback.

Yes I've read the perlre. Unfortunately my client interpretes highly experimental by default as "Oh. So it's feasible". :-)

Precomputing the most inner block gives the same result.

With kind regards.

DirkDn
  • Comment on Re^2: Can "delayed-regex assertions" be nested...

Replies are listed 'Best First'.
Re^3: Can "delayed-regex assertions" be nested...
by moritz (Cardinal) on Feb 21, 2008 at 12:03 UTC
    Unfortunately my client interpretes highly experimental by default as "Oh. So it's feasible". :-)

    As a programmer it's your job to tell him otherwise.

    If possible create an example that segfaults (for example try some fun with closures inside the block), and show that to your client ;-)

    Precomputing the most inner block gives the same result.

    Then you have to unroll one more level:

    !/usr/bin/perl use strict; use warnings; use Data::Dumper; my @A = ( "ab", "abcd", "f" ); my %H = ( 'ab' => 0, 'abcd' => 1, #'def' => 2, ); my $re_inner = join( '|', @A); my $re_outer = join '|', grep /$re_inner/gi, keys %H; my @B = grep ( !/$re_outer/gi, @A ); print Dumper(\@B);

    Disclaimer: I haven't actually understood what you try to achieve, maybe there's a better solution altogether.

      Hi,

      Thanks for both suggestions!

      I just told him :-D

      The objective is to get a list all required elements of @a not present in @b while @b may have optional elements.
      The desired client goal is to have this in a fancy grep oneliner for easy hideous copy-pasting across the code snippets.

      The 2 code snippets reach the objective in an "unfancy way".


      @B = grep ( /(??{join( '|', @A)})/gi, keys %H ); @B = grep ( !/(??{join( '|', @B)})/gi, @A ); print "Delta:\n"; print Dumper(@B); foreach $i (@A){if (!(grep (/$i/i, keys %H))){print "$i\n";};};

        PS It' also a nice opportunity to broaden my perl view ;-).