I feel like I can learn a lot by seeing these two regular expressions as one. Mainly selecting the space in between > and < while not selecting the > and < themselves, so I can replace it with “” rather than “><“. Is there a way that these could be merged without selecting that space?
$html = preg_replace('/(\n)|(\r)/',"",$html);
$html = preg_replace('/>(\s+)</',"><",$html);
1 Answer