Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re: RegEx to filter \s not between labels

by I0 (Priest)
on May 23, 2002 at 21:40 UTC ( #168904=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: RegEx to filter \s not between labels
in thread RegEx to filter \s not between labels

#Okay, you asked for it:

$_ = '0 1 STARTPRESERVE STARTPRESERVE 2 STOPPRESERVE STOPPRESERVE 3 4 STARTPRESERVE STARTPRESERVE 5 STOPPRESERVE STOPPRESERVE 6 7'; (my $re=$_)=~s/((STARTPRESERVE)|(STOPPRESERVE)|.)/${['(','']}[!$2]\Q$1 +\E${[')','']}[!$3]/gs; $re= join'|',map{quotemeta}eval{/$re/}; die $@ if $@ =~ /unmatched/; s/\s+|($re)/${[$1,' ']}[!$1]/g;


Comment on Re: Re: Re: RegEx to filter \s not between labels
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://168904]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (18)
As of 2015-07-31 17:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (280 votes), past polls