phpregexpreg-matchcraigslist

Problem with MySQL storage of a Craigslist parse


I'm using MagpieRSS to parse a Craigslist feed. The "title" field is:

***BUYING ALL BRAND NEW BLACKBERRY IN ANY QUANTITY BOLD~JAVELLIN~ONYX (Gramercy) $100000

and I'm using

if( preg_match( "/\(*\)*\d+$/", $title, $matches ) )

to figure out the price. $matches[0] should have the price, if I'm not mistaken. However, when I put it in my MySQL table (DOUBLE datatype), it comes in as 100. It seems to only take the first 3 digits after the $. I've run this through preg_match checkers all over the web, but nada.

Any thoughts?


Solution

  • Your regex doesn't look like it should work. Given the following title:

    ***BUYING ALL BRAND NEW BLACKBERRY IN ANY QUANTITY BOLD~JAVELLIN~ONYX (Gramercy) $100000

    If you wanted to just get the 100000 value, then I'd use:

    /\$(\d+)$/