[code]
<?php
function more_preg_match($regex,$string)
{
	$return = array();
	$loop = true;
	while ($loop)
	{
		preg_match($regex,$string,$output);
		if (empty($output))
		{
			$loop = false;
		}
		else
		{
			$return[] = $output[0];
			$result = '';
			for ($i = 0;$i < strlen($string);$i++)
			{
				if ($string[$i] == $output[0][0])
				{
					$found = true;
					for ($x = 0;$x < strlen($output[0]);$x++)
					{
						if ($string[$i+$x] != $output[0][$x])
						{
							$found = false;
						}
					}
					if ($found)
					{
						$i += strlen($output[0])-1;
						$something = true;
					}
					else
					{
						$result .= $string[$i];
					}
				}
				else
				{
					$result .= $string[$i];
				}
			}
			$string = $result;
		}
	}
	return $return;
}
?>


Voorbeeldje:

<?php
/*
Verkrijg alle linken uit een string.
*/
$string = '
<html>
<head>
<title>Linkjes! - http://www.deze.nl</title>
</head>
<body>
<a href="http://www.spele.nl">Spelen!</a><br>
Ga ook eens naar http://www.google.co.uk!<br>
<a href="http://www.phphulp.nl">Phphulp!</a>
</body>
</html>
';

echo '<pre><plaintext>'.$string.chr(10).chr(10);

$regex = '/http:\/\/(.*)\.(.*)\.((nl|be|com|co|uk|org)|(nl|be|com|co|uk|org)\.(nl|be|com|co|uk|org))/';

print_r(more_preg_match($regex,$string));
?>
