JSFiddle - React, Tailwind, and code Playground
by Sahin Deniz
HTML
<textarea id="a"></textarea>
<textarea id="b"></textarea>
JavaScript 1.7
let textarea1 = document.querySelector("#a");
let textarea2 = document.querySelector("#b");
textarea2.addEventListener("change", () => {
let words = textarea1.value.replace(/Wingdings/gi, "");
let matches = words.match(/.*?$/gm);
matches = matches.filter(Boolean);
console.log(matches);
let strings = matches.map(text => text.replace(/[^\p{N}]/gui, ""));
let expressions = new RegExp(`.*(?:${textarea2.value}).*`, "gui");
console.warn(matches.map(text => text.replace(expressions, "")).filter((match,index)=> strings[index] == "" ).filter(Boolean).join("|"));
strings = strings.map(text => text.replace(expressions, ""));
strings = strings.filter(Boolean);
strings = [...new Set(strings)];
console.warn(strings.join("|"));
})