title: How to get video id from vimeo url/embed?
body: <p>So I'm trying to get the video id from a vimeo url using a regex.</p>
  
  <p>Based on this: <a href="https://stackoverflow.com/questions/13286785/get-video-id-from-vimeo-url">Get video id from Vimeo url</a></p>
  
  <p>The following regex should do the trick:</p>
  
  <pre><code>if (preg_match("/https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/", $videoLink, $id)) {
          $videoId = $id[3];
      }
  </code></pre>
  
  <p>But it isn't working, and I can't for the life of me work out why.</p>
  
  <p>Is there a difference between regex in Javascript and PHP/am I misusing <code>preg_match</code>? I've looked around on Stack Overflow for a while and just can't find a working regex for getting the video id from a vimeo url/embed.</p>
  
  <p>There are plenty of regex out there for it, but none show their implementation.</p>