Hi,
try the following code. $matches contains the parts in brackets. $matches[1] and $matches[3] are the ones of interest:
<?PHP
$pattern = "/<a.*?href=\"?(.*?)\"?(\W?| .*?)>(.*?)<\/a>/i";
$strLink = <<< EOLINK
<a href="http://www.test.com" style="text-decoration: none;"><span>Test</span><img src="ok.gif"></a>
EOLINK;
$match = preg_match($pattern,$strLink,$matches);
print_r($matches);
$strLink = <<< EOLINK
<a href=http://www.test.com><span>Test</span><img src="ok.gif"></a>
EOLINK;
$match = preg_match($pattern,$strLink,$matches);
print_r($matches);
$strLink = <<< EOLINK
<a href=http://www.test.com style=color:#000000;>Test</a>
EOLINK;
$match = preg_match($pattern,$strLink,$matches);
print_r($matches);
?>
Note: the first link must be on one line.
I tested it on my server and it seemed to work.
Thomas