You cannot use Transform Rules to rewrite the hostname.
Transform Rules allow you to adjust the URI path, query string, and HTTP headers of requests and responses on the Cloudflare global network. Transform Rules · Cloudflare Rules docs
If you are OK with a redirect (as opposed to a rewrite), you can use Redirect Rules (beta). Only Business or Enterprise plan can use the operator “matches regex”. If your plan is Free or Pro, you’d need to combine different operators (is in, is not in, contains etc.) to arrive at your desired redirect behavior.