Jump to content

Recommended Posts

holy crap I actually did a regex!!!

 

$title = "Abit IL9 Pro (Retail, RAID, Gb-LAN, Sound, ATX) - €54,57";
preg_match('/[0-9][0-9],[0-9][0-9]/si', $title, $price);
print_r($price);

 

I'm sure my code is probably primitive but it works Only problem it doesn't work for prices in the hundreds but I will work on that. :)

 

Ray

 

 

got it

 

$title = "Abit IL9 Pro (Retail, RAID, Gb-LAN, Sound, ATX) - €54322,57322";
preg_match('/[0-9]+,[0-9]+/si', $title, $price);
print_r($price);

 

Ray

 

Would it work like this?

preg_match('/- €[0-9]+,[0-9]+/si', $title, $price);

 

EDIT: oh no, sorry, I would get more then just the numbers like this. Oops :D

than continue using the options preg_match offers :)

$title = "Abit IL9 Pro (Retail, RAID, Gb-LAN, Sound, ATX) - €54322,57322";
preg_match('/- € (\d+,\d+)/si', $title, $price);
print_r($price);

 

$price[0] will display the whole match string as u have seen already

$price[1] will display the price value

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.