I have a list of URLs:
site.com/about-us
site.com/blog/a-nice-post
site.com/privacy
site.com/blog/another-post
and I want to extract the text after the last / (i.e. the name of the specific page/post). The result will be:
about-us
a-nice-post
privacy
another-post
- How can I make the extraction to get the desired list?
I figured that if I could get the location of the last "/" I can use the MID function to do so.
- What if the links have "/" as a final character? e.g. site.com/blog/a-nice-post/
How can I still extract the page name (a-nice-post)?
CodePudding user response:
I think this should do it:
=regexextract(A1,"/([^/] )/*$")
ie a slash, then a number of characters other than a slash, zero or more slashes and end of line.