Jump to content

How might I pull this price out of description?


Jeffro

Recommended Posts

okay.. regex is still the hardest thing for me to get, so hoping someone can help with this one. 

 

Can I search my $description, grab the dollar sign and all characters immediately following ...until the next space...  and store that as $price  ? 

 

I'm not using commas or decimal points in $price, so only searching for whole numbers.. though these might be any number of characters ($5, $50, $50000).

 

Many thanks. 

 

Link to comment
Share on other sites

Too much trouble to learn it, eh?

'/\$(\d+)/'

Before I gave you the expression, not the PHP string for preg_match() (which apparently you're using, as opposed to MySQL or ereg() or something else).

 

So how would I have use what you gave me?  Just a bit confused and trying to understand. 

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.