$count_sql = preg_replace("/SELECT(.+?)FROM/", "SELECT COUNT(*) FROM", $sql);
It's probably pretty obvious what I'm trying to do, but I am terrible with regex.
I need to replace anything between SELECT and FROM with COUNT(*).
Tried using (.+), (.+?), (.*), and (.*?).