# Why this match ?

• This post is deleted!

• '.' Matches any single character.

'*' Matches zero or more of the preceding element.

Maybe you should again read the problem, * matches zero or more of the preceding element.

As for
s = "aab" ; p = "c*a*b"
the first * of p will match zero of the first element c then the rest a*b can be matched perfectly.

But in p = "dc*a*b" the first element d is not matched directly, so just return false.

• So as your answer, if the total s can match a part of p, it's true. However, it shows expected answer: false to the test case {aaa, aaaa} after submission.

• Actually I do not quite get what you mean here. If the test case is {aaa, a*aaa} then it will return true, for there is a * after the first a but no then return false directly. It must match the whole pattern but there are many different options to match; s should be one of them to return true.

• @LHearen

In the last test case in the description isMatch("aab", "c*a*b") = true, I think it means "aab" matches "a*b", which is a part of "c*a*b" and I don't think "aab" can match "c*a*b" totally, if the test case is considered true, which implies the true condition is the whole first string can match a part of or the whole second string. However, when I test the case isMatch("aaa", "aaaa"), the expected answer given by Leetcode System is "false". My question is why this one isMatch("aaa", "aaaa") is false if isMatch("aab", "c*a*b") is true?

• @xuemeikang211 Can you just format your reply? It's really hard to read like this. You don't know how to * ? I quite have no idea. Just input the star as you may put it.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.