I have a javascript function which looks for a string of certain format and then converts it into a link
<script>
var re = /Ticket-([0-9]*?(?=-)-[0-9]*)/;
var str = 'ASD Ticket-492-367 - Make my day.';
t = str.replace(re,'<a href="http://myworld/ticket/$1">$0</a>')
document.write(t);
</script>
It looks for Ticket-[some numbers]-[somenumbers] and converts it into a link. Now when i run it seperately in JS editors online it works. But when I run it in my script and lok at the page it does convert the string into a list but prints out literal $0 on the page instead of its value. Is my Javascript correct or ist something else in my script that's probably cuasing the erraneous relsuts. As always, any help is appreciated.