# In the given examples, the last one isMatch("aab", "c*a*b") → true; don't understand why it is true?

• In the given examples, the last one `isMatch("aab", "c*a*b") → true`; don't understand why these two strings matches?

• Please edit your question with markdown syntax. You could use backtick ``` to quote the content `isMatch("aab", "c*a*b") → true`, or the `*` will miss.

• Pay attention to this:

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

So for this testcase `"c*a*b"` could be 0 c 2 a and 1 b, it matched aab.

• is that mean `c*d*a*b` is matched "aab"?

• yes, `c*d*a*b` matches `aab`, `ab` and `b`.

• If so, `isMatch("ab", ".*")→ true` should be wrong.

• `.*` could be `..` and then it can match `ab`.

• I see, so `ca*` matches `caca` ?

• No. Only match `c` `ca` `caa` `caaa` `caaaa` ...

`*` is only work on the preceding one element, not the whole string.

• `c*` matches `null`,`a*` matches `aa` and finally `b` matches `b`.

• This post is deleted!

• you have to combine '*' and its preceding element together.
they together represent 0~n preceding element.

based on this, the preceding element of'' can not be '' or empty

• Still don't understand. No matter you put null or any characters for the *, the leading character of `c*a*b` is always 'c', how could it match "aab" ?

• This post is deleted!

• According to the question, `*` means zero of more PRECEDING element, which means we could have zero `c`. However, by this logic, `isMatch("ab", ".*")→ true` is not correct

• Because "" Matches zero or more of the preceding element.So that "c" can have no c.

• @owen1190

Then how about the `isMatch("ab", ".*")→ true` one?

• @shenggu `".*"`means any length of the any character,so `isMatch("ab", ".*")→ true`

• Still don't get it, how strings matches

`*`