replace plain-text with html using jQuery

javascript replace() returns a new string, it does not alter the original string, so it should probably be:

$(document).ready(function() {    
    var content = $("body").text().replace(/\[this\]/g,'<b>')
    $("body").html(content);
});​

Notice that the brackets will have to be escaped, otherwise it will replace each character inside the brackets with <b>.

Here's a FIDDLE


here is a demo that uses regex:

$(document).ready(function() {    
    // Using just replace
    var text = $('body').text();
    $("body").html(
        text.replace(/\[this\]/g,'<b>').replace(/\[\/this\]/g,'</b>')
    );
});