The Match function
The match function is another function, after the test function, that is very useful when working with regular expressions and testing strings.
There are two main differences than test.
1. The match function takes place on the tested string, and accepts the regex expression as an argument inside the function.
2. The match does not return a boolean like the test function, but an array of all the matches that have been found (in case of g modifier is active, otherwise only the first match). When we say matches, we mean the string itself.
This is very useful when we are trying to find out how many matches of the specified pattern we found in the tested string (the length of the array that comes back in this case).