This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Roughly: type/subtype; name1=value1; name2=value2; ... (.+)\/(.+)(?:;\s*(?:(.+)\s*(?:=\s*(.*))?)?)* \1 = type \2 = subtype { \3 = parameter name \4 = parameter value }*
I added a work-in-progress algorithm for this a few months back: https://github.com/whatwg/mimesniff/commit/d4a84208820af1e74a8d4176ad6966aa294d9127 http://mimesniff.spec.whatwg.org/#parsing-a-mime-type But it's been suggested that I use some ABNF and error handling instead, so I might choose to do that in the future.
I've made enough changes to the algorithm recently that I think this is reasonably complete. (Problems should go in new bugs.)