Replace the Mid() by

RemoveChars(qs, stuff.pos[1], stuff.len[1])

And it should work

Pascal

> -----Original Message-----
> From: Jim McAtee [mailto:[EMAIL PROTECTED]
> Sent: 13 April 2005 03:01
> 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 '';
>   }
> }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202528
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

Reply via email to