PHP - 正则表达式改变'周围'标签

I have a piece of UTF-8 encoded HTML that I need to get one file reference out of, then I need to change it entirely using said file reference.

This is the starting code:

<object width="250" height="20" data="player.swf" type="application/x-shockwave-flash">
<param name="data" value="player.swf" />
<param name="flashvars" value="file=TEST.MP3" />
<param name="src" value="player.swf" />
</object>

As you can see, it's an object tag that contains a reference to a file, and a flash player.

This is the code that I require:

<p><a href="TEST.MP3">TEST.MP3</a></p>

I've tried getting the file reference out first, then just replacing the object part entirely with an a tag, but this just replaces all object tags and not just the one I need.

The easiest way would be ofcourse to just 'replace' the object tag with an a tag, but I don't know how to do a Regex to find and replace everything 'around' the file you need.

What would be the best way to do this?

If you know that the surrounding code will be the same in all future cases and only the TEST.MP3 changes you could use the following RegEx that I've tested:

<?php
header('Content-type: text/plain');
$test = '<object width="250" height="20" data="player.swf" type="application/x-shockwave-flash">
<param name="data" value="player.swf" />
<param name="flashvars" value="file=TEST.MP3" />
<param name="src" value="player.swf" />
</object>';

echo preg_replace('/^\<object.*
.*
.*file\=(.*)\".*
.*
.*/mi','<a href="$1">$1</a>',$test);

?>

This is working in PHP 5.3.10.