I have a php variable where I need to show #value Values as link pattern. The code looks like this.
$reg_exUrl = "/\#::(.*?)/";
// The Text you want to filter for urls
$text = "This is a #simple text from which we have to perform #regex operation";
// Check if there is a url in the text
if(preg_match($reg_exUrl, $text, $url)) {
// make the urls hyper links
echo preg_replace($reg_exUrl, '<a href="'.$url[0].'" rel="nofollow">'.$url[0].'</a>', $text);
} else {
// if no urls in the text just return the text
echo "IN Else #$".$text;
}