JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/ui-lightness/jquery-ui.css">
<textarea rows='20' cols='50'>some text [quote="comment-1"] some more text [quote="comment-2"] and more text</textarea>

<div id="comment-1">Some Quote</div>
<div id="comment-2">Some Other Quote</div>

CSS

tr {
    background: #DDD;
}

JavaScript

var text = $('textarea').val();

text = text.replace(/\[quote="comment-(\d+)"\]/g, function(str,p1) { return $('#comment-' + p1).text(); });
    
$('textarea').val(text);