Implement a function to match regular expressions including ‘.’ and ‘*’.

The character ‘.’ in the pattern represents any character, while the character ‘*’ indicates that the character preceding it can occur any number of times (up to zero).

In this case, matching means that all characters in a string match the entire pattern.

For example, the string “aaa” matches the patterns “a.a” and “abaca”, but not “aa.a” and “ab*a”.

/ * * *@param {string} s
 * @param {string} p
 * @return {boolean}* /
var isMatch = function(s, p) {
    let reg = RegExp(A '^'+p+'$');
    return reg.test(s);
};
Copy the code