Copy link to clipboard
Copied
While loopong through query results I am trying to extract the page name from a url.
From this sample url ------- http://www.cnn.com/sports.cfm
I want to extract the name sports.cfm only
or
From this sample url ------- http://www.msnbc.com/shows.asp
I want to extract the name shows.asp only
Copy link to clipboard
Copied
I'll give you a clue - think of the string as a list, separated by forward slashes
Copy link to clipboard
Copied
Have you checked CFLIB.ORG? I think there are number of variations on a function that parses out the parts of a URL. Also, along Owain's comment, is what I usually do: Use a CF list function with a delimiter of ? to get the "left" part of a URL, then whack a possible trailing / at the end of what's left, then use a CF list function with a delimiter of / to get the last element of the list.
Many of the CFLIB functions use a regex. I think that the CFWACK books even use a URL parsing example to show how to use CF regex functions.
-reed