Regular Expressions 101

Community Library

Your search did not match anything

Community Library Entry

1

Regular ExpressionOpen Workspace

"
(?<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
Created·2024-02-22 19:45
Type·Match
Flavor·Java

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
Open Workspace