Regular Expressions 101

Community Patterns

Community Library Entry

3

Regular Expression
PCRE (PHP <7.3)

/
([A-Z0-9a-z\'\.\s\(\)]*)(\s\-\s)([A-Z0-9a-z\'\.\s\(\)]*)(\.)(mp3|m4a)
/
g

Description

Split an audio filename into a readable format for playlists (like jPlayer) assuming the audio file is named like the following: Artist - Song Title.mp3 Band Name - Track Title ft. Another Artist.m4a demon.devin - Faithless Angel (to no avail remix).mp3

Submitted by demon.devin - 8 years ago