powered by
Parsed according to RFC 2616, as at http://pretty-rfc.herokuapp.com/RFC2616#media.types.
parse_media(x)
String to parse
A simplified minimal EBNF is:
media-type = type "/" subtype *( ";" parameter )
type "/" subtype *( ";" parameter )
type = token
token
subtype = token
parameter = attribute "=" value
attribute "=" value
attribute = token
value = token | quoted-string
token | quoted-string
token = 1*<any CHAR except CTLs or ()<>@,;:\"/[]?=\{\}
1*<any CHAR except CTLs or ()<>@,;:\"/[]?=\{\}
# NOT RUN { parse_media("text/plain") parse_media("text/plain; charset=utf-8") parse_media("text/plain; charset=\"utf-8\"") parse_media("text/plain; randomparam=\";=;=\"") # }
Run the code above in your browser using DataLab