Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Title Re: collapsing revisited

by Dog and Pony (Priest)
on Jun 08, 2002 at 15:48 UTC ( #172797=note: print w/replies, xml ) Need Help??


in reply to Re: Title Re: collapsing revisited
in thread Title Re: collapsing revisited

Well, I guess that could be done, as another user setting. Something like
s{(?<=Re:) \(\w+\)}{}g;
might even get the job done, although I haven't tried it enough. And then you put it through the collapse sub to put those Re:s together.

$& has its uses too, in this case it was the best way I could come up with. ;-)


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

Replies are listed 'Best First'.
Re^3: Title Re: collapsing revisited
by tadman (Prior) on Jun 08, 2002 at 20:23 UTC
    I suppose what I was wondering was why you left your match unmemorized, and then used $&. I've been lead to believe that's bad form, since once you open that Pandora's box ($`, $& and $'), all your regexes become slower as a result.
      Oh. I had actually forgot that. Do you know if that is the same thing with @- and @+? I can use those instead, at the price of higher obfuscation... :)

      Thanks for the heads up!

      (I just *had* to change the Re: style *grin*).


      You have moved into a dark place.
      It is pitch black. You are likely to be eaten by a grue.
        (Me too. :-))

        Makeshifts last the longest.

Re^3: Title Re: collapsing revisited
by Aristotle (Chancellor) on Jun 08, 2002 at 21:06 UTC
    Like tadman++ noted the problem is that once you use it, all regexes anywhere in the script become slower - not likely to be tolerable in the context of the Everything engine.. And this one in particular is pretty simple: $title =~ s{((?:Re: ){2,})}{"Re(" . length($1)/4 . "): "}ge; Works a treat for your test cases.

    Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2021-08-04 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (43 votes). Check out past polls.

    Notices?