.*?)(\', episode=\')(?.*?)(\', action=)(?.*?)(, timestamp=)(?.*?)(, started=)(?.*?)(, position=)(?.*?)(, total=)(?.*?)}]*/', $episodeActionString, $matches ); file_put_contents('actionreader.log', var_export($matches, true), FILE_APPEND); return new EpisodeAction( $matches["podcast"], $matches["episode"], $matches["action"], $matches["timestamp"], (int)$matches["started"], (int)$matches["position"], (int)$matches["total"], ); } }