简体   繁体   中英

How to get page title from URL in Google Sheets?

If cell A1 contains URL text:

http://my.URL.com/some/path/my-page.html

How can I write a formula in A2 which extracts the page title:

my-page

You may try =REGEXEXTRACT with a regex featuring the following regex:

"^.*/(.*)\.[^.]+$"

It matches:

  • ^ - start of string
  • .*/ - matches the string up to the last /
  • (.*) - matches and captures any 0+ chars up to the last .
  • \\. - a dot
  • [^.]+ - 1 or more chars other than a dot
  • $ - asserts the position at the end of string.

Note that once a capturing group is defined in the pattern, REGEXEXTRACT returns the submatch captured.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM