var secondValue = 9;
var testString = "the result is 8 and " + secondValue + " as shown above";
var stringToTestAgainst1 = "the result is * and " + secondValue + " as show above";
var stringToTestAgainst2 = "the result is * as show above";
You can use a regular expression:
/the result is \d+ as shown above/.test('the result is 8 as shown above') // => true
\d+ checks for the presence of one or more digits.
You can check for the presence of many things, like
\d for digit,
\w for any alphanumeric character, etc. The reference above provides many examples.