Regular Expressions 101

Community Patterns

Mime type parser


Regular Expression
.NET 7.0 (C#)



A "simple" regex to parse mime types. Handles all commonly occurring parts of a mime type string such as:

  • Type
  • Subtype
  • Subtype's with an extra extension (e.g. svg+xml) (Optional input)
  • Multiple parameters (Optional input)

Tested with:

  • application/text
  • image/svg+xml
  • image/svg;q=0.9,/;q=0.8
  • image/svg+xml;q=0.9,/;q=0.8
  • application/vnd.uplanet.listcmd-wbxml;charset=utf-8
Submitted by Vespion - a year ago (Last modified a year ago)