Jump to content

Reading a site


spikeon

Recommended Posts

I am writing a code that will read a public database to gather information

 

i have hit a snag where there can be more than one result for a specific type

 

The Result could be:

<tr><td class="TextResultsRowHeader">Set/Rarity:</td><td class="TextResultsRowValue">Morningtide Common</td></tr>

Or:

<tr><td class="TextResultsRowHeader">Set/Rarity:</td><td class="TextResultsRowValue">Morningtide Common, Ninth Edition Common, Onslaught Common</td></tr>

Or many other variations, with up to 7 different sets and raritys.

 

i want to seperate all of the sets from this list

 

here is my regex:

  ereg(".*<tr><td class..TextResultsRowHeader.>Set/Rarity:</td><td class..TextResultsRowValue.>([a-zA-Z ]{1,30}) [a-zA-Z]{1,10}[,]{0,1}([a-zA-Z ]{0,30}) [a-zA-Z]{0,10}[,]{0,1}([a-zA-Z ]{0,30}) [a-zA-Z]{0,10}[,]{0,1}([a-zA-Z ]{0,30}) [a-zA-Z]{0,10}[,]{0,1}([a-zA-Z ]{0,30}) [a-zA-Z]{0,10}[,]{0,1}([a-zA-Z ]{0,30}) [a-zA-Z]{0,10}[,]{0,1}([a-zA-Z ]{0,30}) [a-zA-Z]{0,10}</td></tr>.*",$str, $matches);

 

however, it dosen't seem to work.

 

Help Please!!!

Link to comment
Share on other sites

<?php

$str = '<tr><td class="TextResultsRowHeader">Set/Rarity:</td><td class="TextResultsRowValue">Morningtide Common, Ninth Edition Common, Onslaught Common</td></tr>';

preg_match("/Set\/Rarity:<\/td><td class=\"TextResultsRowValue\">(.*?)<\/td>/", $str, $match);
$data = explode(", ",$match[1]);
echo "<pre>"; print_r($data); echo "</pre>";

?>

 

 

Orio.

Link to comment
Share on other sites

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.