Regular Expressions 101

Community Patterns

File path seperator

0

Regular Expression
PCRE (PHP <7.3)

/
(\/?.+\/)*(.+?)(?:\..+)?$
/
mg

Description

Seperate any file from it's path and trim extention, creating two groups

Submitted by Edward Aryee - 8 years ago