Regular Expressions 101

Community Patterns

1...34567...881

IANA Media Type

1

Regular Expression
Java 8

"
(?<type>text|font|model|audio|image|video|application|message|multipart) \/ ( (?<tree>[-_0-9a-z\.]+\.)? (?<subtree>[-_0-9a-z]+)* ) (\+ (?<suffix>[-_a-z0-9]+) )? (?<parameters>;\s* (?<parameter>(?<param>[-a-z0-9]+)\s*=\s*(?<value>[-a-z0-9]+)) )*
"
ixg

Description

Parses an IANA Media Type value.

Doesn't seem to capture repeating parameters, which is a bit of an edge case but valid I think - any suggestions on how to fix would be appreciated.

Submitted by scottbdr - 3 months ago