in reply to Regular expression question

Another way.

$re = qr[ ( the(?{$rep='The'}) | quick(?{$rep='Quick'}) | brown(?{$rep='Brown'}) | fox(?{$rep='Fox'}) ) ]x; $s = 'the quick brown fox'; $s =~ s[$re][$rep]g; print $s; The Quick Brown Fox

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Timing (and a little luck) are everything!

Replies are listed 'Best First'.
Re: Re: Regular expression question
by demerphq (Chancellor) on Jan 15, 2004 at 23:27 UTC

    You are one evil, sick, and twisted individual.

    Just thought someone should let you know.

    ++

    update:lol


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi


      Your right. I should have added a little more whitespace to clarify things :)

      $re = qr[ ( the (?{ $rep = 'The' }) | quick (?{ $rep = 'Quick' }) | brown (?{ $rep = 'Brown' }) | fox (?{ $rep = 'Fox' }) ) ]x;

      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      Timing (and a little luck) are everything!