How do I use Preg_match to query the value, alpha/num?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

How do I use Preg_match to query the value, alpha/num?

Post by simonmlewis »

Code: Select all

      $romanstock = "http://www.remoteprice.com/data.asp?storeid=*****&itemcode=$row->romancode&type=2";
      $contentsstock = file_get_contents($romanstock);
      preg_match('/var cText = \'([0-9]+)\'/', $contentsstock, $matches);
This code queries a URL and then comes back to say what numeric value is found.
But now the company that provides it, occasionally has the word "multi" in there.

So I need to query it into $matches, and just see whatever the hell is in there - whether it is 1, 2, 3.... multi... fred?!

How do I do that?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply