var sample = "@sample";
sample = sample.replace(/[^\s+-+.+](@\w+|#\w+|http://[\w\./]+)[$\s+-+.+]/g, "<a>$1</a>");
$1 .
( ):
var sample = "@sample";
sample = sample.replace(/[^\s+-+.+](@\w+|#\w+|http://[\w\./]+)[$\s+-+.+]/g, function(str) {
var href="";
if(str.indeoxOf("#") !== -1)
href=str;
else if(str.indexOf("@") !== -1)
...
return "<a href="+href+">"+str+"</a>";
});
- , . , , href .
, MDC.