why not just do something like

<cfset pCode = ListLast(ListGetAt(ListLast(CGI.HTTP_REFERER, "?"),
ListFindNoCase(ListLast(CGI.HTTP_REFERER, "?"), "pCode", "&"), "&"), "=")>

its a bit messy and untested - but...

-----Original Message-----
From: Nick Han [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 3:19 PM
To: CF-Talk
Subject: RE: regular expressions (was: please do my work for me)


that's messy i think.  i would loop through the cgi.http_referer.

<cfset pCodeValue="No pCode value Found">

<cfloop list="#cgi.http_referer#" index="i" delimiters="&">
 <cfif Find("pCode",i) and ListLen(i,"=") eq 2>
  <cfset pCodeValue=ListGetAt(i,2,"=")>
 </cfif>
</cfloop>

<cfoutput>#pCodeValue#</cfoutput>

With this, it doesn't matter what the length of pCode value, you will get
the exact number returned.


Nick Han

>>> [EMAIL PROTECTED] 09/25/02 02:48PM >>>
Ooops I'm sorry, I'm actually trying to extract this value from the
cgi.HTTP_REFERER variable. Here's what I'm currently using:

<cfif (isDefined("cgi.HTTP_REFERER")) AND (FindNoCase("pCode=",
CGI.HTTP_REFERER))>
    <cfset variables.pCode = mid(cgi.HTTP_REFERER,FindNoCase("pCode=",
CGI.HTTP_REFERER)+6,2)>
</cfif>

My only problem is when the pCode starts to vary in length - they're not
going to be two digits forever. Thanks for any help you can provide.

Adam.


> -----Original Message-----
> From: Adrian Lynch [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 25, 2002 4:44 PM
> To: CF-Talk
> Subject: RE: please do my work for me
>
>
> Why not just return URL.pCode ?
>
> Ade
>
> -----Original Message-----
> From: Cantrell, Adam [mailto:[EMAIL PROTECTED]]
> Sent: 25 September 2002 22:38
> To: CF-Talk
> Subject: please do my work for me
>
>
> I want to extract a value from a URL variable which can show
> up anywhere in
> the URL. Here are some examples, I would want the pCode value
> which will
> always be an integer of varying length:
>
> index.htm?var1=23&pCode=100&othervar=hello -------- return 100
>
> index.htm?pCode=1 ------- return 1
>
> index.htm?someVariabl=hiThere&someothervariable=45&pCode=00343
> 223234322
> --------- return 00343223234322
>
> If somebody can tell me the right regular expression (or if a regular
> expression isn't even needed, but just some combination of CF
> functions)
> that would be GREAT!
>
> Adam.
>
>
>


______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to