I've developed a powerful regex that locates specific text within a lengthy string without spaces. Now I'm attempting to utilize it dynamically to search for various words, but I can't seem to make it function as intended.
const targetWord = "8.469.505-k"
const expression = '/\b(\w*'+ targetWord +'\w*)\b/g'
const cleanText = text.replace(/ /g, "")
if( cleanText.match(new RegExp(expression, 'g')) ){
console.log("Successfully found the word")
}