Wow ... that didn�t come in like I typed it.. sorry it was all jumbled -----Original Message----- From: Ewok [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 13, 2005 9:49 AM To: CF-Talk Subject: RE: Regex help
<cfset urltext = "http://somesite.com/dir/file.cfm?var=value" /> <cfset info1 = listrest(listrest(urltext, "//"), "/") /> <cfset info2 = listfirst(listrest(listrest(urltext, "//"), "/"), "?") /> <cfset info3 = listlast(listrest(urltext, "//"), "/") /> <cfset info4 = listfirst(listlast(listrest(urltext, "//"), "/"), "?") /> <cfoutput> #urltext#<br /> <br /> INFO1: #info1#<br /> INFO2: #info2#<br /> INFO3: #info3#<br /> INFO4: #info4#<br /> </cfoutput> <!--- THE OUTPUT ---> http://somesite.com/dir/file.cfm?var=value INFO1: dir/file.cfm?var=value INFO2: dir/file.cfm INFO3: file.cfm?var=value INFO4: file.cfm <!--- END OUTPUT ---> -----Original Message----- From: Jim McAtee [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 12, 2005 9:01 PM 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 ''; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:202575 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

