> Combining John's answer and a variant of Michael's: > > > > my $str = q/aw bcdefaw e a rt zzz kjkjkjaw qa/; > > print "$str\n"; > > # Look for a string > > $str =~ s/ > (?<=aw) # Preceded by 'aw' > ((?!aw).)*? # Not containing 'aw' > (?=zzz) # followed by 'zzz' > /TXT/x; > > print "$str\n"; > > OUTPUT > > aw bcdefawTXTzzz kjkjkjaw qa > > > HTH, > > Rob
^^^^ This way the replacing string is a bit shorter, but the overall Regex is about 30% slower. Michael ---------------------------------------------------------------------------------------------------------- Intelligenz ist etwas, von dem die meisten Menschen verschont blieben... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]