Regular Expression Matching

class Solution {
public:
bool isMatch(const char *s, const char *p) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(*p == '')
return *s == '';
if(*(p+1)!='*')
{
if(*p==*s||(*p=='.'&&*s!=''))
{
return isMatch(s+1,p+1);
}
else
{
return false;
}
}
else
{
while(*p==*s||(*p=='.'&&*s!=''))
{
if(isMatch(s,p+2))
{
return true;
}
s++;
}
return isMatch(s,p+2);
}
}
};

原文地址:https://www.cnblogs.com/727713-chuan/p/3305504.html