Jump to content

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

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.