On 4/27/05, Peter Rabbitson <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 27, 2005 at 01:31:08PM -0400, Jay Savage wrote:
> >
> > Don't make things so complicated.  You want to find some words and
> > replace them with nothing.  You don't care where in the string the
> > pattern appears.  Therefore, you don't have to predict where in the
> 
> The word 'ups' is not mandatory - it might be there, might not. Also the
> amount of spaces inbetween is not fixed. However what you said about me not
> caring where the string is - you are right. I dropped  (?:(^)|(?<=\S)) from
> the front, and it produces identical results. Thanks!
> 

You can drop the stuff from the end, too.  If 'ups' is optional and
the spacing is variable, then of course handle that with *

    $description =~
s/\s*free\+(?:ups)*\s*ground\s+shipping\s*[!]*\s*//i;  # or /ig if
needed

Rearrange to suit.  But the imporant thing here is to go for what you
need to replace, and not what you don't.

HTH,

--jay

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to