Regular Expressions 101

Community Patterns

1...34567...881

Detect Multiple File Extensions

1

Regular Expression
PCRE (PHP <7.3)

/
^([\w.]{1,})\.([\w]{3,4})\.([\w]{3,4})$
/
gm

Description

I use this to find files with two or more extensions (i.e. file.txt.txt). This will work with files with 3 or 4 character or numeric (or both) file extensions (i.e. pdf, xlsx).

Submitted by Curve - 3 months ago (Last modified 3 months ago)