Re: bulky regex
- From: daggerquill@xxxxxxxxx (Jay Savage)
- Date: Wed, 27 Apr 2005 13:50:57 -0400
On 4/27/05, Peter Rabbitson <rabbit@xxxxxxxxx> 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
.
- Follow-Ups:
- Re: bulky regex
- From: Peter Rabbitson
- Re: bulky regex
- References:
- bulky regex
- From: Peter Rabbitson
- Re: bulky regex
- From: Jay Savage
- Re: bulky regex
- From: Peter Rabbitson
- bulky regex
- Prev by Date: Re: bulky regex
- Next by Date: Re: bulky regex
- Previous by thread: Re: bulky regex
- Next by thread: Re: bulky regex
- Index(es):
Relevant Pages
|