3 ms·
var search_term_is_found = base_text.match( new RegExp("(?=(.|[\r\n])" + search_term .match(/"([^"]+)"|[\w]+/gi) .join(")((.|[\?=r\n])") .replace(
by xfreestar 4y ago
var search_term_is_found = base_text.match(
new RegExp("(?=(.|[\r\n])" + search_term
.match(/"([^"]+)"|[\w]+/gi)
.join(")((.|[\?=r\n])")
.replace(/\"/g,'')+")(.|[\r\n])+", "ig")
)!=null
Built Using RegEx Negative Lookaheads
bar(?=bar) finds the 1st bar (“bar” which has “bar” after it)