At 9:03 AM +0100 4/25/01, DeVoil, Nick wrote:
>  > I shudder to recall those heady days when the popular challenge was
>"I can write that APL program in 1 line".... but I don't remember
>what it does... and can't figure out how it does it!
>
>Unfortunately those days have not gone, on the contrary...
>
>s/APL/Perl/gi
>
Nick

Yes and no... you chose a regexp to illustrate your point... there is 
a lot more magic/complexity to Perl than regexp,.. the I/O, alone, is 
a thing of wonder.


But, I do think that the time spent to learn regexp pays dividends, 
regardless of the programming language you use them in.

Even here, CF's rather weak implementation (getting better with each 
release), allows you to do things like parsing/removing html tags... 
in an efficient and straight-forward way.  For example the code to 
format a WDDX packet for display:

   <cfset xx = CFHTTP.FileContent>

   <cfset xx = ReReplace(xx, "\<([^\/])",        "<ul>&lt;\1",      "ALL")>
   <cfset xx = ReReplace(xx, "\<([\/][^\>]+\>)", "<br>&lt;\1</ul>", "ALL")>

or the Perl equivalent (not tested)

   $xx =~ s/\<([^\/])/<ul>&lt\;\1/g;
   $xx =~ s/\<([\/][^\>]+\>)/<br>&lt\;\1</ul>/g;


while at first glance is gibberish, it is simple, efficient and 
actually quite elegant.  I must admit, the CF code is actually more 
readable than the Perl equivalent.


My point is regexp even though cryptic, are a good thing.  They are 
especially useful to any one who uses CF's powerful cfhttp tag to 
harvest information from other sites:

   pulling stock prices, shipping rates, airline schedules, news articles, etc.

   manipulating various formats text of text or html files.

Regexp are your friend... I only wish Flash supported them.

Dick







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to