> -----Original Message----- > From: John Munyan [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 10, 2005 3:03 AM > To: CF-Talk > Subject: Regular expression help > > Hi, I have an url such as > http://www.blah.com/something/somethingelse/default.cfm stored in a > database. I wish to use this information as links to others site which > have similar reviews. I would like to parse down the full url to on > the domain i.e. http://www.blah.com <http://www.blah.com/> - for > display purposes. I have searched around trying to find an example and > have been unsuccessful. Does anyone have any pointers to how to parse > the domain out of the url? The nearest I have found is > #REReplace(getsimilarlinks.linkurl,"\?.*$","")#.
If all of your links are fully formed like that you don't need regexs at all - just treat the URL as a list delimited by a forward slash ("/"). Since CF condenses multiple delimiters I think this will give you your URL: <cfset Link = "http://www.blah.com/something/somethingelse/default.cfm " /> <cfset JustDomainLink = ListGetAt(Link, 1, "/") & "//" & ListGetAt(Link, 2, "/") /> Using the ListGetAt() for the first part (the protocol) is important to catch none http links like "https:" and "ftp:". Jim Davis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:214303 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54