gryphon has asked for the wisdom of the Perl Monks concerning the following question:
Greetings fellow monks,
This seems like such a simple problem, and perhaps it is and my brain is just extra slow today, but I need your help. I've got a rather long text string in a scalar from which I'd like to filter out multiple white spaces, converting them into just a single space per instance. Simple enough:
$text =~ s/\s+/ /g;However, I'd like to not do this between a starting label and ending label. Here's some example text:
A Bridge Too Far Hosted by Rod Stuart Friendly Skys 42 STARTPRESERVE Life, the universe... and Everything STOPPR +ESERVE X-Files HotWheels are cool More movies on Fox File server
Basically, I'd love to have a simple regex that does the /\s+/ /og except not do anything between STARTPRESERVE and STOPPRESERVE. Any thoughts? (My appologies if this is really basic. I'm having a bad brain-day.)
-gryphon
code('Perl') || die;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: RegEx to filter \s not between labels
by I0 (Priest) on May 23, 2002 at 00:30 UTC | |
by tye (Sage) on May 23, 2002 at 01:59 UTC | |
by gryphon (Abbot) on May 23, 2002 at 16:27 UTC | |
by I0 (Priest) on May 23, 2002 at 21:40 UTC | |
•Re: RegEx to filter \s not between labels
by merlyn (Sage) on May 23, 2002 at 00:26 UTC | |
by merlyn (Sage) on May 23, 2002 at 00:49 UTC | |
Re: RegEx to filter \s not between labels
by talexb (Chancellor) on May 23, 2002 at 00:24 UTC | |
(jeffa) Re: RegEx to filter \s not between labels
by jeffa (Bishop) on May 23, 2002 at 00:30 UTC | |
Re: RegEx to filter \s not between labels
by abstracts (Hermit) on May 23, 2002 at 17:31 UTC |