Jump to content

[SOLVED] preg_match_all patterns


Porl123

Recommended Posts

I've got this page of html from a page I'm logged in and retrieving using curl but I don't have a clue what pattern I'd need to use with preg_match_all to get the data I need. The data I need is a sum of money and the sentence I need to get it from is this-

 

  The maximum bet is set at <b>$150,000</b>.<br>

 

It's for a casino maximum bets page I'm making for a site I'm on. If anyone can help me I'd greatly appreciate it. Thanks! :)

Link to comment
https://forums.phpfreaks.com/topic/145576-solved-preg_match_all-patterns/
Share on other sites

<?php
$string = "The maximum bet is set at <b>$150,000</b>.<br> and The maximum bet is set at <b>$25,000</b>.<br>";
preg_match_all("~maximum bet is set at <b>\\$(.+?)</b>~si", $string, $matches);

foreach ($matches[1] as $bets) {
echo $bets . "<br />";
}
die();
?>

 

Whether or not that is the best way to do it...it works with the example you gave us..

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.