How to match file extensions?

Matching files that do not have a specific extension

This regex will match filenames that do not end in png or jpg.

Regex: ^.*\.(?!jpg$|png$)[^.]+$

Matching multiple file extensions at once

This regex will match multiple multiple file names and extensions (jpg, png and gif)

Regex: ^([a-zA-Z0-9\s_\\.\-\(\):])+\.(jpg|png|gif)$



The latest tutorials sent straight to your inbox.