in reply to Greedy RegExp

Can you exclude angle brackets from your wildcards? That should prevent crossing tag boundaries.
/<img[^<]*WantToGetRidOfThis.gif[^>]*>/

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re: Re: Greedy RegExp
by fourmi (Scribe) on Mar 15, 2004 at 16:15 UTC
    Nail on the head. Thanks. Had wondered if there was an antigreedifier like .+? but this does the job brilliantly. soemtime i wish i didn't think so hard!
    cheers
    ant
      Had wondered if there was an antigreedifier like .+?
      Oh, there is. And it's spelled .+?. But greedy or lazy (aka 'antigreedy'), still has to yield to more important rules like finding the left-most match.

      Abigail