-
-
Notifications
You must be signed in to change notification settings - Fork 163
Closed
Description
Method preg_match doesn't seem to be working properly after installing Safe.
I made a regex to split spotify URL and retrieve the id. Here is my code which is working when I remove Safe's use function :
public function getTrackIdFromUrl(string $url): ?string
{
$spotifyRegex = "/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/";
preg_match($spotifyRegex, $url, $matches);
return $matches[1] ?? null;
}
For the url https://open.spotify.com/track/0nCqpKBrvDchO1BIvt7DTR?si=iLUKDfkLSy-IpnLA7qImnw the return of $matches[1] should be 0YCRJcAXQ3NSfKN1x1IXK3.
With Safe, $matches returns null.
Thank you for the awesome lib :)
Metadata
Metadata
Assignees
Labels
No labels