Need help ! / Find Numbers with Regular Expressions

Tell us what’s happening:

Your code so far

var test = (function() {
  var testString = "There are 3 cats but 4 dogs.";

  // Only change code below this line.

  var expression = /\d+/gi;

  // Only change code above this line.
  // We use this function to show you the value of your variable in your output box.
  return testString.match(expression).length;
})();(function(){return test;})();


Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0.

Link to the challenge:
https://www.freecodecamp.org/challenges/find-numbers-with-regular-expressions

The first / means the start of the pattern (not required in some regex impl)

The second / means end of the pattern (not required in some regex impl)

The g means iterative search, means once an index of regex is found, continue for next

The i means case-insensitive, helpful when working with chars

The \d means any digit(decimal), and + means 1 or more.

Use this great online tool for more detail