嘿,我有一些文本格式是这样的:
[quote]foo text[/quote]我想把它改成这样:
<div class="quote-text">foo text</div>我如何使用JS来做这件事?
我使用的是jQuery。
发布于 2009-09-04 04:49:47
以下命令应该可以完成此操作:
string.replace(/\[quote\](.*?)\[\/quote\]/g, "<div class=\"quote-text\">".$1."</div>");发布于 2009-09-04 04:49:27
var myString = "blah blah [quote]test[/quote] foo bar [quote]another thing[/quote]";
myString.replace(/\[quote\](.*?)\[\/quote\]/g, '<div class="quote-text">$1</div>');https://stackoverflow.com/questions/1377266
复制相似问题