Regular Expressions 101

Community Patterns

Match popular media type such as audio, images and/or videos

0

Regular Expression
ECMAScript (JavaScript)

/
(audio|image|video|x-(?:[0-9A-Za-z!#$%&'*+.^_`|~-]+))\/([0-9A-Za-z!#$%&'*+.^_`|~-]+)
/
g

Description

A regex that matches popular media types like audio, images and/or video. Can be adjusted to any media file type.

Submitted by Javier Carrion - 3 years ago