JavaScript and RegEx regular expressions + string variable + javascript code. var body = "this is a \n blob of text that could be an article or whatever."; var search_string = "Blob of text"; var re = new RegExp(search_string, "gim"); var output = body.match(re); console.log(output); if ( body.match(re) ) { console.log("match"); } else { console.log("no match"); } code..