SPUG: SQL syntax Regular Expression

SPUG-list-owner tim at consultix-inc.com
Thu Jun 20 11:15:05 CDT 2002


On Thu, Jun 20, 2002 at 12:21:17AM +0000, Dan Sanderson wrote:
> 
> This may or may not be worth mentioning in this particular case, but since
> I learned this lesson the hard way, I feel like mentioning it every time I
> see $` and $' (and $&) mentioned.  From camel, 24.2.1:
> 
>  Avoid $& and its two buddies, $` and $'. Any occurrence in your program
>  causes all matches to save the searched string for possible future
>  reference. (However, once you've blown it, it doesn't hurt to have more
>  of them.)

It's page 146 in the 3rd edition, which makes it clear that capturing
parens have the same performance hit too, and you hardly see people
becoming zealots in their avoidance!

Jeffrey Freidl needs to update his "Mastering Regular Expressions"
book, which is also scaring innocent Perl programmers away from using $&
and friends.  I talked to him about this on Christmas Day Y2K (I know,
"get a life"), after spending a week failing to document any deleterious
effects on performance of $& usage, in connection with research for my
"Advanced Pattern Matching" with Perl course.  I couldn't measure any
substantial performance hit at all, and he said "Yea, after my book was
published, they fixed those problems.  And by the way, O'Reilly keeps
bugging me to update the book, but I don't have time".  I've since heard
that he might actually be updating the book sometime soon.

-Tim
*==============================================================================*
|  Tim Maher, CEO, CONSULTIX  (206) 781-UNIX; (866) DOC-PERL; (866) DOC-LINUX  |
|   tim at consultix-inc.com  teachmeunix.com  teachmeperl.com  teachmelinux.net  |
|    JULY 8-11: OO Perl Fundamentals;  JULY 29-31: Database Prog. with Perl    |
*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
| NEW Seminar Series!  "DAMIAN CONWAY's Adv. Perl Workshop";   Seattle 7/15-19 |
|  Adv. OOP  *  Adv. Module Techniques  *  Programming Perl 6  *  Text Parsing |
*==============================================================================*

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org




More information about the spug-list mailing list