Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: RegEx to filter \s not between labelsby I0 (Priest) |
on May 23, 2002 at 00:30 UTC ( [id://168628]=note: print w/replies, xml ) | Need Help?? |
$text =~ s/\s+|(STARTPRESERVE.*?STOPPRESERVE)/${[$1,' ']}[!$1]/gs
UPDATE: jeffa, If you think that's twisted, you should see the version for nested START STOP markers:-) to remove the markers: s/\s+|STARTPRESERVE(.*?)STOPPRESERVE/${[' ',$1]}[defined $1]/gs
In Section
Seekers of Perl Wisdom
|
|