JSFiddle - React, Tailwind, and code Playground

HTML

<div id="res">

</div>

JavaScript

var query = 'static value %url% {{.thisclass}} {{{(\d+)}}}';
var html = '<h1 class="thisclass">Test</h1><h2 class="thisclass">Test2</h2> 1234 12';
var url =  "http://perdu.com";

query = query.split(" ").map(o=>{
        return o.replace(/\{\{\{(.*)\}\}\}/g, "$1");
}).map(o=>{
        return o.replace(/\{\{(.*)\}\}/g, "$1");
});

var el = document.createElement( 'div' );
el.innerHTML = "<div class='outer'>"+html+"</div>";

var t1 = $("h1").text(); 
var t2 = $("h2").text();
var out = $(".outer").text();

var newArr = [];
newArr.push(query[0]+" "+query[1]+" "+url+" "+t1+t2+out);
newArr.push("{{{triple brackets = "+query[4]+"}}}");
newArr.push("{{double brackets = "+query[3]+"}}");

console.log(newArr);
newArr.map(o=>{
$("#res").append(o+"<br>");
});