weina67 Posted July 23, 2009 Share Posted July 23, 2009 so I'm having so much trouble understanding preg_match. I'm trying to use curl to request data from quantcast.com for sites like google.com and then use php to parse the html output. For example, the html embodies the following: <tbody> <tr class="current "> <td class="title"> <a href="/digg.com"> digg.com </a> </td> <td class="reach digit"> 12.6M <p class="label"> Monthly US People</p> </td> How do I parse the code to get the 12.6M Month US People? I want to get the "12.6" from the html code above. What preg regular expression should I use? I'm so confused! Anyone who could help, I would be so grateful. Thanks Just to clarify ... I wanted to use preg_match. Like parse the code $regexp = '#<td class="reach digit">(.*?)</td>#si'; preg_match($regexp, $response, $matches); to get the 12.6M. But I keep using the wrong regular expression so $matches arrays remains empty. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.