$ereg = '`<lien=([0-z\-]+)>(.*?)</lien>`';
$str = preg_replace($ereg, '<a href="http://www.example.com/?p=$1">$2</a>', $str);
<lien=machin-chose>coucou</lien>
$leTexte=preg_replace('#\[lien=([^\]]+)\]([^[\[]+)\[\/[^\]]+\]#i',"<a href='http://www.ndd.com?truc=\1'>\2</a>",$leTexte);