Regular Expressions 101

Community Patterns

Community Library Entry

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 - 4 years ago