Results are in!

The "most elegant" solution, to me (subjectively) was Tom's.  It was
short, 2 lines, 2 CF functions, easy to read and figure out what was
going on.  Dare I say pretty?

<cfset reResults = reFind("numPageID=([0-9]+)",CGI.HTTP_REFERER, 1,true)>
<cfset theNum = mid(CGI.HTTP_REFERER, reResults.pos[2],reResults.len[2])>


Marlon wins for least amount of characters.  Concise, efficient but
hard for me to follow the regex.  Definitely a guy's solution.  He
could have made it one character shorter by using "gettoken" instead
of "listgetat"!

<cfset pagenum =
listgetat(rereplacenocase(CGI.HTTP_REFERER,"[(?|&)]*numpageID=(\d*)","#chr(10)#\1#chr(10)#","all"),2,chr(10))>


Chris, Rick and Anthony's solutions were just about the same.  Logical
and easy to understand.

<cfset ReferrerQS = ListLast(CGI.HTTP_REFERER, "?")>
<cfloop index="eachParamSet" list="#ReferrerQS#" delimiters="&">
    <cfif ListFirst(eachParamSet,"=") IS "numPageID">
       <CFSet MyNumPageID = ListLast(eachParamSet,"=")>
    </cfif>
</cfloop>


Mine was the worst, which is why I submitted this to the group to begin with!

Thanks for playing!
Joe Kelly

On 9/14/06, Joe Kelly <[EMAIL PROTECTED]> wrote:
Whoa!  I just got back to this!  First thing - Settle down boys!
I guess since I posed the question I get to judge.  I'll go through
all the submissions, review carefully, and come back with a report and
my version of "elegance".
To clarify, it was Tom who asked for the "Henny Youngman" - one liner.
Thanks,
Joe Kelly

On 9/14/06, Christopher Jordan <[EMAIL PROTECTED]> wrote:
>
>  I think I would venture to say that a language that doesn't incorporate a
> good regular expression engine, isn't worth using because sometimes there
> just isn't any other way... and at those times, I drag out the trusty pocket
> reference and go at it! :)
>
>  Joe? Afraid to jump back in the water? Where you at? :P
>
>  Chris
>
>
>
>  Marlon Moyer wrote:
> Yeah, I think it just goes back to whatever your definition of "elegant" is,
> again.  So, this really just becomes Joe's fault for not properly phrasing
> the challenge :)
>
>  Seriously though, regular expressions are one of the most powerful aspects
> of the CF language imnsho. :)
>
>
>
>
> On 9/14/06, Christopher Jordan <[EMAIL PROTECTED]> wrote:
> >
> >
> > I typically consider shorter solutions to problems more clever and often
> times more elegant too. Ken, brought up the dictionary definition of elegant
> and it mentioned "simple". If regular expressions are easy for one person to
> read because they're very comfortable with them and they think in regular
> expressions, then I'd agree that it's more simple. More elegant. For other
> folks (like me, unfortunately), who have to pull out the regular expression
> pocket guide every time they run into  all but the very simplest of regular
> expressions (and sometimes even the really simple ones), the slightly longer
> four or five line solution seems simpler, and therefore more elegant.
> >
> > What about that? Agree? Disagree? :)
> >
> > Chris
> >
> > Marlon Moyer wrote:
> >
> >
> >
> >
>
>
>
>  --
>  Marlon
>
>
> ________________________________
>
>  _______________________________________________ Reply to
> DFWCFUG: [email protected] Subscribe/Unsubscribe:
> http://lists1.safesecureweb.com/mailman/listinfo/list List
> Archives:
> http://www.mail-archive.com/list%40list.dfwcfug.org/
> http://www.mail-archive.com/list%40dfwcfug.org/ DFWCFUG
> Sponsors: www.HostMySite.com www.teksystems.com/
>
> _______________________________________________
> Reply to DFWCFUG:
>   [email protected]
> Subscribe/Unsubscribe:
>   http://lists1.safesecureweb.com/mailman/listinfo/list
> List Archives:
>     http://www.mail-archive.com/list%40list.dfwcfug.org/
>   http://www.mail-archive.com/list%40dfwcfug.org/
> DFWCFUG Sponsors:
>   www.HostMySite.com
>   www.teksystems.com/
>
>
>

Attachment: joetest.cfm
Description: application/cfm

Attachment: joetest2.cfm
Description: application/cfm

_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.HostMySite.com 
  www.teksystems.com/

Reply via email to