Skip to main content
1 of 2

#PHP, 1192 bytes:

<?=
'<pre>'.
(function ($compressed) {
preg_match_all("#(^.+?)\n(.+$)#us", $compressed, $matches, PREG_SET_ORDER);
list($schema, $compressed) = [ $matches[0][1] , $matches[0][2] ];
for ($ix = strlen($schema) - 1; $ix >= 0; $ix--) {
    $char = $schema[$ix];
    $charQuoted = preg_quote($char, '#');
    preg_match_all("#{$charQuoted}(.+?){$charQuoted}#mus", $compressed, $matches1, PREG_SET_ORDER);
    $fullQuoted = preg_quote($matches1[0][0], '#');
    $compressed = preg_replace("#{$fullQuoted}#mus", $matches1[0][1], $compressed);
    $compressed = str_replace($char, $matches1[0][1], $compressed);
}
return $compressed;
})(
'!"$%&*+-./0123456789:;<=>?@BCEFHJKLMPQRSTU
We9\'re9 n5o L5sLtrangSerSs2 t25lo<ve<4
YMouM4/ knowB/2heB rules0C aC>nd> 0s5d5I
AP fPull commitQmeQnt\'sE wEhatR I\'mR2hink:ingK: Kof4EMldn\'t6 g6et2hisPromCny= othS=6uy%
I justEanna2FellF1* 1yM*. howRPeel:
.Gotta Hmake1Hu>Ssta>!%
-
N$-e<r?6TonTna ?$g+Ji<J1up+-let1down-runCrM>0desSt*-Hcry-say6oodbye-tFC lie0hurt*!7

We\'</7n" each=Por s5lTg4r hear8t\'s been8CchKbut492oLhy2L@ay it
@InsideEe both/Eha86oKT
WeB6aQ0we9?pl@"A> if1ask Q.DT\'t2F Q*92o5bli>2LeeU!!U
3
(Ooh3,6;+);3,6&;3)-gJ, n$gJ
(G&&;7"%U'
).'</pre>';
?>

Live DEMO of arbitrary text (de-)compression