@enriquewang Thanks,here is my python version with 2.689s

class Solution(object):
def isMatch(self, s, p):
def match(i,j):
return True if i<len(s) and (s[i]==p[j] or p[j]=='.') else False
def backtrack(i,j):
if j==len(p):return i==len(s)
if j+1<len(p) and p[j+1]=='*':
if backtrack(i,j+2):return True
while match(i,j):
i+=1
if backtrack(i,j+2):return True
return False
elif not match(i,j):return False
else:return backtrack(i+1,j+1)
return backtrack(0,0)

here is my promoted version with cache, 62ms with a huge promotion

class Solution(object):
def isMatch(self, s, p):
cache=set({})
def match(i,j):
return True if i<len(s) and (s[i]==p[j] or p[j]=='.') else False
def backtrack(i,j):
if (i,j) in cache:return False
if j==len(p):return i==len(s)
if j+1<len(p) and p[j+1]=='*':
if backtrack(i,j+2):return True
else:cache.add((i,j+2))
it=i
while match(i,j):
i+=1
if backtrack(i,j+2):return True
else:cache.add((i,j+2))
cache.add((it,j))
return False
elif not match(i,j):cache.add((i,j));return False
else:return backtrack(i+1,j+1)
return backtrack(0,0)