I'm trying to match ^Description^*http://google.com*
and convert into URL. It's working with JS, but I don't know how implement this into PHP Array.
My JS looks like this:
var that = $(this);
var vid = that.html().match(/\^(.*)\^/gm);
var vid2 = that.html().match(/\*(.*)\*/gm);
var vid2 = jQuery.trim(vid2).slice(1,-1);
var vid1 = jQuery.trim(vid).slice(1,-1);
that.html(function(i, h) {
return h.replace(/\^(.*)\^\*(.*)\*/gm, '<a target="_blank" href="'+vid2+'">'+vid1+'</a>');
});
And my PHP Array:
$find = array('/\*\*([^*]+)\*\*/', '/@(\\w+)/');
$replace = array('<span style="font-weight:bold">$1</span>', '<a href=/profile/$1>@$1</a>');
$result = preg_replace($find, $replace, $comment_text);