How do I determine whether a string is a valid handle?

Is there a way to programmatically determine if a string is a valid handle? I’m thinking of a library or API. I’ve checked out the Java client library at (http://www.handle.net/client_download.html) but didn’t find anything useful. At our organization we filter out handles from many different strings, for example:

We basically want only the values:

Jing, other than checking for the prefix, there isn’t much you can do as basically everything is allowed. DataCite uses this regular expression:

/\A10\.\d{4,5}\/[-\._;()\/:a-zA-Z0-9\*~\$\=]+\z/

But this excludes characters that allowed in handles, but very hard to work with when used in URLs.