if this is an issue of wild-card subdomains, how do you think the best way to handle it is?
You'll have to compromise. Your preferred form is with-www, right? Then something like
%{HTTP_HOST} ^(ww?\.)?example\.com(:\d+)?$
to encompass
example.com
w.example.com (heck, may as well include it!)
ww.example.com
and also anything with that pesky port number stuck to the end. I don't think a request for .example.com with leading dot would reach you, so you don't need to allow for that possibility. (I just repeated my previous experiment with a couple of sites that do redirect misspelled urls, and all I got was the browser saying "Ain't no such place".)
That letter w is disorienting isn't it? I keep wanting to add an escape slash \ to make it into a word character \w.
Wilderness, you still out there? Got an idea you know the answer to this one. Does Apache support the {,2} form? As in w{,2} meaning "from zero to two w's".
Come to think of it, stinky, do your subdomains have a minimum length? If they have to be at least three characters long, then you've got it made. That way you really
could say
^\w\w?\.example\.com et cetera
to redirect everything that's too short to your default www.
Now, there's one more thing you need to do. You can expect the occasional typo, but if you have a
lot of ww.example.com requests, you'd better fine-tooth-comb your own site and make sure you don't have any misspelled internal links. Also check any external links that you've got control over.