JSFiddle - React, Tailwind, and code Playground
by blesh
HTML
<p>RegExp:</p>
<textarea id="regexp"></textarea>
<br/>
<p>Text:</p>
<textarea id="text"></textarea>
<hr/>
<p>Output:</p>
<pre id="output"></pre>
CSS
textarea {
width: 100%;
}
JavaScript
$('#regexp').on('keyup change', function (e) {
var r = new RegExp($(this).val(), 'g');
var txt = $('#text').val();
var matches = r.exec(txt);
console.clear();
console.log(matches);
$('#output').text(JSON.stringify(matches, null, ' '));
});