JSFiddle - React, Tailwind, and code Playground

by momenelkamri

JavaScript

const arr = ['hello', 'test', 'two words']

const string = 'this is two sstsest words';

arr.forEach(o=>{

console.log(o);

let r = new RegExp(o.replace(" ",".*"),"g");

console.log(r.test(string));

});