I'm trying to replace everything in between [lorem]
and [/lorem]
. For example:
[lorem]Here goes some text[/lorem]
will turn into
These is inside a lorem block
I've manged to make it work with [[Here goes some text]]
, using
var block = $('body').html().replace(/\[[^\]]+\]]/ig, "This is inside a lorem block");
$('body').html(block);
but I can't, for the life of me, make it work using the former, either because I'm doing something wrong or I don't actually understand how that works. Also, what does ^
in the replace function do? I'm guessing it means something like "anything in between" but of course I could be wrong. Where can I read about those?