Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Title Re: collapsing revisited

by Dog and Pony (Priest)
on Jun 08, 2002 at 15:48 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-29 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found