Regular Expressions 101

Community Patterns

Community Library Entry

4

Regular Expression
PCRE (PHP <7.3)

/
(?i:^.*\.(xls|xlsx|doc|docx)$)
/

Description

Validates a File Path and makes sure the correct extension is at the end.

Submitted by Andrew Morpurgo - 10 years ago