This one is probably better <cfset string = "http://www.mydomain.com/missingdirectory/dfgfdgf/index.cfm" />
<cfset result = reFindNoCase( "^http:/{2,}[^/]*(/.*$)", string, 1, true ) /> <cfdump var="#result#"> <cfdump var="#mid( string, result.pos[ 2 ], result.len[ 2 ] )#"> -- Taco Fleur Senior Web Systems Engineer http://www.webassociates.com -----Original Message----- From: Jim McAtee [mailto:[EMAIL PROTECTED] Sent: Wednesday, 13 April 2005 11:01 AM To: CF-Talk Subject: Regex help (CF5 on IIS, Win2k Server) I have a CF template set up as the IIS 404 error handler on a web site. When IIS detects a 404 error it calls the CF page and passes the original request within the CGI variable cgi.query_string in the following form: 404;http://www.mydomain.com/missingpage.htm or if the request was for a directory it might look like: 404;http://www.mydomain.com/missingdirectory/ In my template I need to extract what would have been the original cgi.path_info: /missingpage.htm or /missingdirectory/ What might a CF function look like using regexes to extract the trailing part of the URL? There will be many different host (domain) names pointed at the site, so I can't match the domain name. The function would be called by passing cgi.query_string: <cfset path_info = getPathInfo(cgi.query_string)> The function below is start, but it matches the entire string rather than "extracting" just the end part. function getPathInfo(qs) { var re = '404;http://[^/]+/*'; var stuff = REFindNoCase(re, qs, 1, 'yes'); if (stuff.pos[1]) { return Mid(qs, stuff.pos[1], stuff.len[1]); } else { return ''; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202516 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54