title: Extract Google drive folder id from URL's
body: <p>I am just trying to extract the Google drive folder id from bunch of different google drive URL's</p>
  <p><code>cat links.txt</code></p>
  <pre><code>https://drive.google.com/drive/mobile/folders/1mzr8lgf50p9z6p-7RyHn4XjnyKSvyyuE?usp=sharing
  
  https://drive.google.com/open?id=1_7vwy0-y0BqvPOtG2Or4pvoChnZHrHAx
  
  https://drive.google.com/folderview?id=1rOLhig0g3DdgB9YfvW8HiqRA6o6LxAFF
  
  https://drive.google.com/file/d/1o2J_NwHS3l1-fM71HaDN-xxres1jHkb_/view?usp=drivesdk
  
  https://drive.google.com/drive/folders/0AKzaqn_X7nxiUk9PVA
  
  https://drive.google.com/drive/mobile/folders/0AKzaqn_X7nxiUk9PVA
  
  https://drive.google.com/drive/mobile/folders/0AKzaqn_X7nxiUk9PVA/1re_-YAGfTuyE1Gt848vzTu4ZDC6j23sG/1Ye90fM5qYMYkXp4QMAcQftsJCFVHswWj/149W7xNROO33zaPvIYTNwvtVGAXFxCg_b?sort=13&amp;direction=a
  
  https://drive.google.com/drive/mobile/folders/1nY48t6MATb0XM-iEdeWzEs70qXW2N4Y9?sort=13&amp;direction=a
  
  https://drive.google.com/drive/folders/1M3Xp3xz44NS8QJO5XJT5DK55MohwN6tF?sort=13&amp;direction=a
  </code></pre>
  <p>Expected Output</p>
  <pre><code>1mzr8lgf50p9z6p-7RyHn4XjnyKSvyyuE
  
  1_7vwy0-y0BqvPOtG2Or4pvoChnZHrHAx
  
  1rOLhig0g3DdgB9YfvW8HiqRA6o6LxAFF
  
  1o2J_NwHS3l1-fM71HaDN-xxres1jHkb_
  
  0AKzaqn_X7nxiUk9PVA
  
  0AKzaqn_X7nxiUk9PVA
  
  149W7xNROO33zaPvIYTNwvtVGAXFxCg_b
  
  1nY48t6MATb0XM-iEdeWzEs70qXW2N4Y9
  
  1M3Xp3xz44NS8QJO5XJT5DK55MohwN6tF
  </code></pre>
  <p>After an hour of trial/error , i did came up with this regex - <code>([01A-Z])(?=[\w-]*[A-Za-z])[\w-]+</code></p>
  <p>It seems to work almost well except it can't process the 3rd last link properly. If there are multiple nested folder ids in URL, i need the innermost one in the output . Can someone please help me out with this error and possibly improve the regex if it can be done in a more efficient way than mine</p>