Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Title Re: collapsing revisited

by Aristotle (Chancellor)
on Jun 08, 2002 at 21:38 UTC ( [id://172841]=note: print w/replies, xml ) Need Help??


in reply to Title Re: collapsing revisited

This works against all your test cases.
sub re_collapse { local $_ = $_[0]; # explode all collapsed in one go s{Re.(\d+).?: } { "Re: " x $1 }ge; # re-collapse (no pun intended) s{ ( (?:Re:\ ) {2,} ) } { "Re(" . length($1)/4 . "): " }xge; return $_; }
A dedicated re_add seems pointless to me since you want to collapse all existing "Re:"s at that point anyway, so I suggest just passing it "Re: $title"; it seems cumbersome to me to implement that functionality using extra code.

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://172841]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (None)
    As of 2024-04-18 23:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found