```
def isMatch(self, s, p):
dp = [[False]*(len(p)+1) for j in range(len(s)+1)]
dp[0][0] = True
for i in range(0, len(s)+1):
for j in range(1, len(p)+1):
dp[i][j] = dp[i][j-2] or i>0 and (s[i-1] == p[j-2] or p[j-2] == '.') and dp[i-1][j] \
if p[j-1] == '*' else i>0 and dp[i-1][j-1] and (s[i-1] == p[j-1] or p[j-1] == '.')
return dp[-1][-1]
```