Search code examples
phpregexpreg-matchvimeo

PHP - Vimeo video detection for preg_match()


I'm trying to detect, whether my Vimeo link is in Vimeo format (http://www.vimeo.com/nnnnnnn)

I tried this:

preg_match("/http:\/\/(www\.)?vimeo\.com\/(\d+)/", $link);

However, it doesn't seem to work. Whats wrong? Thanks.


Solution

  • preg_match("/https?:\/\/(?:www\.)?vimeo\.com\/\d{8}/", $input_line, $output_array);
    

    http://www.phpliveregex.com/p/2pa