I'm actually glad that Tom submitted the solution he did. I have to admit to never using the optional start and returnsubstrings arguments to reFind. I ran his example:

<cfset string = "?thisID=12&thatID=20&TheOtherID=30&numPageID=1000&TheThirdID=40">
<CFDump var="#string#"><br>
<cfset reResults = reFind("numPageID=([0-9]+)",string, 1,true)>
<CFDump var="#reResults#"><br>
<cfset theNum = mid(string, reResults.pos[2],reResults.len[2])>    
<CFDump var="#theNum#"><br>


... and now I actually understand what it's doing. well worth the effort.

This was fun. Let's do another! :)

Chris

Joe Kelly wrote:
That was just Chad and he was punched for hanging out.

On 9/14/06, Marlon Moyer <[EMAIL PROTECTED]> wrote:
I demand a recount!  There were several voters in Florida whose votes
weren't counted!



On 9/14/06, Joe Kelly < [EMAIL PROTECTED]> wrote:
>
 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/
> >
> >
> >
>


_______________________________________________

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/






--
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/


_______________________________________________
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