Discussions

Expand all | Collapse all

How to extract just the page name from a URL

  • 1.  How to extract just the page name from a URL

    Posted 06-27-2017 18:54
    Let's say I have a text or URL field that contains the following:

    http://www.domainname.com/pagename.html

    How would I go about extracting just "pagename" without "http://www.domainname.com/" before it and without ".html" after it? And can a formula do it generically so that it can handle a variant like this?

    https://domainname.org/directory/pagename2.htm

    Note that this example has https instead of http and has no www. and has a different TLD (.org) than the first example (.com) and has a page name that ends in .htm instead of .html

    Can this be done with a single formula?


  • 2.  RE: How to extract just the page name from a URL

    Posted 06-27-2017 19:16
    Try this

    var text RightToSlash = right([my field],"/");
    Left($RightToSlash,".")


  • 3.  RE: How to extract just the page name from a URL

    Posted 06-27-2017 19:20
    Wonderful (and very elegant)! Thank you, Mark!