PHP Regex Problem?



Greetings,

How can I solve the problem below using PHP regex?
The text below needs to be converted:

<?php
$text 
'This is <em>nice</em>. Click <a href= "http://example.com"> here </a>';
?>

to
<?php
$text 
'This is nice. Click here (http://example.com)';
?>

Any help?



Do something like this:

<?php

//match for all text in href="" and store in m using preg_replace
preg_match_all('/href="([^"]+)"/'$text$m);

//Use array m to replace </a> with ($m) value calculated in preg_replace in $text
$text str_replace('</a>'' (' $m[1][0] . ')'$text);

// strip all html tags now
$text strip_tags($text);
?>