Encoding question 2: matching similar to wildcards
description: implementation supports"." The rules for matching similar wildcards with"* "are as follows:
- "." Match any single character
- "* "matches zero or more previous elements
- isMatch (s, r); s is the matching target string, r is the string with matching characters The match of
- r should override s
example:
isMatch("aa","a") // return false
isMatch("aa","aa") // return true
isMatch("aaa","aa") // return false
isMatch("aa", "a*") // return true
isMatch("aab", "a*") // return false
isMatch("aa", ".*") // return true
isMatch("ab", ".*") // return true
isMatch("ab", ".a") // return false
isMatch("ab", ".b") // return true
isMatch("aab", "c*a*b") // return true
function isMatch(s, r) {
/* */
}
so how should I write it? I really couldn"t figure it out at that time. The brain may be useless