I have a string:
https://domain.tld/123456/api/v1/projects/45242457-foo-bar.json
And I'm trying to match '45242457-foo-bar' using:
preg_match('~"/projects/(.*).json"~', $url, $matches, PREG_OFFSET_CAPTURE);
This keeps returning zero matches. Why?
"for?parse_url()(php.net/manual/en/function.parse-url.php) to get info about urls. It is a much easier and better solution than a regex.~) are your delimiters in this case