Remove everything after the final "/" in Google Sheets

Viewed 2601

I have some private Vimeo Pro urls, where they add what looks like a UUID to the end to enable privacy. Unfortunately it seems like you cannot set the "End Screen" option as Thumbnail by default for new uploads or turn off Likes, Watch Later either. Therefore I need to edit these in bulk via Google Sheets, which has a handy "Open Links" which enables you to highlight and open links in multiple tabs.

How can I get the "base" Vimeo url from a private Vimeo Pro video URL?

So this would be

https://vimeo.com/400532154/

from the private URL, which is

https://vimeo.com/400532154/b0fedc9dc3

I have tried the following as well as plenty of other formulas from Google but with no joy.

=LEFT(A2, LEN(A2) - FIND("/", A2))

Here is the Google Sheet, you can Make a copy with File-Make a Copy

3 Answers

You may use a REGEXEXTRACT to extract the part of the URL that starts with https://vimeo.com or http://vimeo.com and the subsequent subpart:

=REGEXEXTRACT(A24, "(?i)^https?://vimeo\.com/[^/]+")

See the RE2 regex demo.

Details

  • (?i) - case insensitive modifier
  • ^ - start of string
  • https?:// - https:// or http://
  • vimeo\.com/ - a vimeo.com/ substring
  • [^/]+ - 1+ chars other than /.

You can also use this one:

=REGEXREPLACE(A2, "[^/]+$", "")

enter image description here

Related