SPUG: SQL syntax Regular Expression

Josh Lanza joshlanza at hotmail.com
Tue Jun 18 21:28:25 CDT 2002


Hi,

I need to create a regexp to validate and correct apostrophe characters
in sql statements, and I left my Friedl book at home :(

Example:

$sql  = "select * from tbl_1 where field_1 = 'bob's value'";

There is a tick (bob's) that is not escaped (should be bob''s).

Is this something I can handle with regular expressions? The idea of 
crawling this string byte by byte seems a little distasteful ...

TIA, Josh

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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