Reputation: 1440
I need to get just the Video Id from any keeks video link
Examples of Links from keeks.com
https://www.keek.com/syahrin/keeks/QC06cab
https://www.keek.com/!QC06cab
https://www.keek.com/syahrin#QC06cab
https://www.keek.com/embed/QC06cab
I need the output just QC06cab
Upvotes: 1
Views: 80
Reputation: 89547
You can use a character class that exclude delimiters and anchor the pattern to the end of the string:
if (preg_match('~[^/!#]++$~', $url, $match))
print_r($match);
Upvotes: 1