Re: bulky regex
- From: rabbit@xxxxxxxxx (Peter Rabbitson)
- Date: Wed, 27 Apr 2005 13:00:47 -0500
On Wed, Apr 27, 2005 at 01:50:57PM -0400, Jay Savage wrote:
> 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.
Mmm... as I wrote in the comments in the very first e-mail:
> blablabla...I want to keep the space if I am cutting from inside a string
Is there a way to do this without the lookahead? Yes I can replace with / /,
but then I am introducing more spaces than there were if I am at the
beginning or at the end...? Excuse my curiosity :)
.
- References:
- bulky regex
- From: Peter Rabbitson
- Re: bulky regex
- From: Jay Savage
- Re: bulky regex
- From: Peter Rabbitson
- Re: bulky regex
- From: Jay Savage
- bulky regex
- Prev by Date: Re: bulky regex
- Next by Date: my (fooref) = shift;
- Previous by thread: Re: bulky regex
- Next by thread: my (fooref) = shift;
- Index(es):