PDA

View Full Version : RegExp



nick saint
20 Jun 2009, 9:43 PM
Hi, sorry for the question as it cannot be applied to none of the forums
I have a question about RegExp.

I have a text something like:

<script language="javascript">

var id =32582
var reg = '2'
region[id] = reg;
</script>
<option value="32582" minimum="1">
<span>Australia</span>

</option>How can I get by means of RegExp the value, minimum from option and country form span which is inside the option?

I was able to get only value and minimum values by means of two separate RegExp but still cannot get country.

$pattern = "!<option[^>]*\svalue=[\"']?(\d{5}+)[\"']?[\"']?[^>]*>!isU"; //[^>\"'#\s]
preg_match_all($pattern, $content, $c_code);

echo "<PRE>";
print_r($c_code[1]);Any help appreciated.
Nick

evant
20 Jun 2009, 9:54 PM
Is there any reason you have to use a regex? Give more context.

nick saint
20 Jun 2009, 10:02 PM
I simply need to take the data from a web page. I do not mean steal but copy. The page is a property of ours.

nick saint
21 Jun 2009, 3:41 AM
Can someone help?

Animal
21 Jun 2009, 7:25 AM
Chuck that into a div (It doesn't even have to be in the document, just create one), and use DomQuery.