You'll have to manually enter every redirection. That would mean one rule for each subdomain redirection.
Rule for testing.domain.com
(Of course, if this is X2, the host name must include *.domain.com)
Regex: /*
Case sensitive: doesn't matter, just leave checked
Condition 1 variable: HTTP Header: Host (HTTP_HOST)
Condition 1 operator: Matches with
Condition 1 regex:
testing.domain.com
Condition 1 case sensitive: unchecked
Apply to subrequests too: leave checked
If this rule matches: Perform an external redirection
Redirect to:
http://domain.com/testing/
Append query string: checked
Escape redirection location: checked
Status Code: 301 or 302
Follow the above for every subdomain you want redirected. Just change what's in bold face for each redirection. It's kind of a pain, but you're requesting a very specific setup.
As for non-existent subdomains, you'll have to have PHP handle that one in your custom 404 error page. The variable you're going to deal with is $_SERVER[HTTP_HOST] in PHP.