I would submit that regular expressions, just like coldfusion, php, c#, Japanese, Greek, Hebrew, English... are only hard to read if you don't understand them. As developers of a language with regex support, we should all be familiar with them. Whereas most dictionary definitions of elegance allude to a level of simplicity and precision, I think that a one-line regex-based solution might well be thought of as elegant indeed.
Thanks, Ken Ferguson 214.636.6126 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Eben Elmore Sent: Wednesday, September 13, 2006 8:11 PM To: 'Dallas/Fort Worth ColdFusion User Group Mailing List' Subject: RE: [DFW CFUG] Brain Teaser Joe asked for an elegant solution. Why does everyone think that means condensed, bizarre, and hard to read? Is that your idea of "elegant" code? Would you like to maintain code that looks like this: listgetat(rereplace(test,"[(?|&)]*pageNum=(\d*)","#chr(10)#\1#chr(10)#", "all "),2,chr(10)) My idea of elegance would involve having a URL object that receives a URL, parses it, and provides a method, getVar(), from which you can retrieve any URL variable. getVar("numPageID") -Daniel Elmore -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marlon Moyer Sent: Wednesday, September 13, 2006 7:44 PM To: Dallas/Fort Worth ColdFusion User Group Mailing List Subject: Re: [DFW CFUG] Brain Teaser <cfset pagenum = listgetat(rereplace(test,"[(?|&)]*pageNum=(\d*)","#chr(10)#\1#chr(10)#", "all "),2,chr(10))> On 9/13/06, Joe Kelly <[EMAIL PROTECTED]> wrote: I want to see if someone can come up with a more elegant solution to this problem. Given: CGI.HTTP_REFERER will always have a URL variable, "numPageID=xxx" which is numeric and could be any size number. The HTTP_REFERER may or may not have other URL variables in any order, which could be alphanumeric or numeric The current template needs to pull the value of the "numPageID" URL variable out of the CGI.HTTP_REFERER I'll show my solution in another post so as not to spoil anyone's view on this problem, not saying that mine is best, of course! Thanks, Joe Kelly _______________________________________________ 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/
