Ну, в большинстве случаев регулярное выражение
^\d+\. (.*) - (.*)\.mp3$
должно работать.
^ start of the string
\d+ at least one digit
\. a literal dot
(.*) the artist, in a capturing group. Matches arbitrary characters
until the following literal is encountered
- a literal space, dash, space
(.*) the title, in a capturing group
\.mp3 the file extension
$ end of the string
Вы можете сопоставить свои строки с регулярным выражением с помощью функции preg_match
:
$matches = array();
preg_match('/^\d+\. (.*) - (.*)\.mp3$/', "01. Wham - Last Christmas.mp3", $matches);
$artist = $matches[1];
$title = $matches[2];