I need to get the javascript replace() function to replace every instance of a [b] or [/b] with <b>
or </b>
. I tried this with the global tag but it doesn't work and comes out oddly:
document.write(str.replace(/[b]/g,'<b>').replace(/[/b]/g,'</b>'));
results in the output being:
[<>]<>la<>la[<>][<>]<>la<>la[<>]
I also tried changing the first part to:
document.write(str.replace(/[[b]]/g,'<b>').replace(/[[/b]]/g,'</b>'));
which kind of works, but there's odd ]s everywhere... like so:
[blabla[/[blabla[/
I know there's probably something obvious I'm missing here... But I can't find it... any help and I will love you forever XD