Can some one explain this to me ?

$rg_link_http = "h(ttps?://" . $rg_url . ")";

$CON = preg_replace('#\[([^\]]+)\|' . $rg_link_http . '\]#U', '<a href="xx$2" class="url">$1</a>', $CON);
I know this is parsing the line:

to html code :

<p><a href="" class="url">LionWiki</a> </p>
But what if I want to add another variable so that if it exists, it will add it to the variable ?

So, if I wanted the to give

[Google||onMouseover="ddrivetip('Visit this google page')"; onMouseout="hideddrivetip()]
It will make the link like this:

<a href="" onMouseover="ddrivetip('Visit this google page')"; onMouseout="hideddrivetip()">Search Engine</a>
as you can see it just added the third variable parsed by | to the href tag.

It can be done with just one line but I dont know how - Please help