JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id="textArea" ></textarea><br>
<input id="input1" /><br>
<input id="input2" /><br>
<input type="button" value="Replace" id="btnReplace" />
<div id="output">OUTPUT!</div>

JavaScript

var getById = document.getElementById.bind(document);
getById('btnReplace').onclick = doReplace;
function doReplace() {
    var get = function(id) { return getById(id).value };
    var text = get('textArea'),
        input1 = get('input1'),
        input2 = get('input2'),
        div = getById('output');

    var regex = new RegExp(input1, "g"); // to replace globally you need this!
    div.innerText = text.replace(regex, input2).toUpperCase();
}