Skip to content

Commit 6a4d871

Browse files
committedJun 2, 2019
2019-06-02
1 parent 72459a8 commit 6a4d871

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎0010.正则表达式匹配/0010-正则表达式匹配.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ def isMatch(self, s, p):
55
:type p: str
66
:rtype: bool
77
"""
8-
if not p: #Èç¹ûpΪ¿Õ£¬s²»¿Õ£¬return false£¬ s¿Õ, return true
8+
if not p:
99
return not s
10-
1110
match = s and p[0] in [s[0], "."]
1211
if len(p) > 1 and p[1] == "*":
13-
return self.isMatch(s, p[2:]) or (match and self.isMatch(s[1:], p))
14-
return match and self.isMatch(s[1:], p[1:])
12+
return self.isMatch(s, p[2:]) or (match and self.isMatch(s[1:], p))
13+
return match and self.isMatch(s[1:], p[1:])
14+

0 commit comments

Comments
 (0)
Please sign in to comment.