Hey, I have some text that is formatted like this:
[quote]foo text[/quote]
and I want to change it to this:
<div class="quote-text">foo text</div>
How can I do this with JS?
I'm using jQuery.
Hey, I have some text that is formatted like this:
[quote]foo text[/quote]
and I want to change it to this:
<div class="quote-text">foo text</div>
How can I do this with JS?
I'm using jQuery.
var myString = "blah blah [quote]test[/quote] foo bar [quote]another thing[/quote]";
myString.replace(/\[quote\](.*?)\[\/quote\]/g, '<div class="quote-text">$1</div>');
The following should do it:
string.replace(/\[quote\](.*?)\[\/quote\]/g, "<div class=\"quote-text\">".$1."</div>");