0

I am trying to search text for a given string using match. However what I am searching for is not a constant value.

console.log((data.match(/VARIABLE/g) || []).length)

I have tried this:

console.log((data.match(/${VARIABLE}/g) || []).length)

But still coming back as no match as "${VARIABLE}" is not in the text i am searching.

thanks in advance :)

Ivar
  • 5,377
  • 12
  • 50
  • 56

0 Answers0