[PHP] not sure why regex is doing this

2004-01-09 Thread craig
Hi, I have a text file that I have to parse and insert into a db. these are a couple of sample lines (they are part of the variable $query) (4536,'golf tournament management',430,0,0), (1434,'Premium golf balls',,,0), I have to replace the blank entries (,,) with NULLs, and I am using this

Re: [PHP] not sure why regex is doing this

2004-01-09 Thread Kelly Hallman
On Fri, 9 Jan 2004, craig wrote: (4536,'golf tournament management',430,0,0), (1434,'Premium golf balls',,,0), I have to replace the blank entries (,,) with NULLs, using this regex: $query = preg_replace('/,\s*,/',',NULL,', $query, -1); after this line, only ONE of the ,, sets is replaced

RE: [PHP] not sure why regex is doing this

2004-01-09 Thread craig
Thanks Kelly. That works just like I wanted, only starting the regex engine once. Guess I'll have to figure out lookahead. -Craig -Original Message- From: Kelly Hallman [mailto:[EMAIL PROTECTED] Sent: January 9, 2004 11:24 AM To: craig Cc: Php Subject: Re: [PHP] not sure why regex