Regular Expressions 101

Community Patterns

Read Music Directory

0

Regular Expression
PCRE (PHP <7.3)

/
(?P<file>^(?P<artist>[a-zA-Z0-9\'\.\s\(\)]*)\s\-\s(?P<title>[a-zA-Z0-9\'\.\s\(\)]*)\.(?P<format>mp3|m4a)$)
/
gm

Description

Can be used to read a file with a list of songs or read a directory of songs for the artist, song title, and the songs format. Assuming there are named in that exact order (i.e. Artist - Title.format)

Example: demon.devin - deception.mp3

Submitted by anonymous - 4 years ago