Preg_match PHP help needed - $5?


Power Member
Jan 10, 2009
Reaction score
This is what i want to read out from a html file , 600, 800);return false;">some text that changes</a>

I want the text between the > and the <

(There are about 400 of these... i want every two occurrences of it, or all of them and i will sort it afterwards)

This is what ive come up with - it doesnt work obviously

$website = "1.html";
		$curl = curl_init();
		curl_setopt($curl, CURLOPT_URL, $website);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
		$page = curl_exec($curl);
		curl_close($curl);      //;return false;">100.00% USD</a>
		preg_match("/(;return false;\">)(.*?)(</a>)/", $page, $match);
		echo "First result".$match[1];
		echo count($match);

Please can someone help me out and describe exactly what the command does, ive read a tutorial but its late and my head hurts :confused::confused:

$5, a +rep, a digital kiss, whatever you want, just please help :p

preg_match_all('/;return false;">([^<]*)/', $page, $matches);

for($i = 0;$i<count($matches[1]);$i++)
echo $matches[1][$i];
echo '<br>';


preg_match_all and only regular expressing the parts that you want in brackets for the win. The match will be an array of arrays, with [0] being fullmatches and [1] being the bracket matches, what we want.
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock