I actually don't even understand why (aab, c*aab) is a match. * is defined as ' Matches zero or more of the preceding element.' What is about 'c'? It doesn't match any in the first string. 'Proceeding element means 'c'? Even it means 'c' and * match zero proceeding element, 'c' is still there and it doesn't match any of the element in the first string. Is this question allow the second string has something the is not matching first string as long as it has all the elements in the first string?
This question is not explain wild card expression, but the regular expression.
So for (aab, c*aab) => we can have 0 or more 'c' => match (0 'c')
for (aab, caab) => not match (the first char is not same)
Thanks, now I get it. * decide the letters in front of it, whether include them or not. That is making sense. Thanks for the clarification.
But why "aaa", "." is match. if * >> 0, then .>" " OR ". ". If >>previous one, ".*" >> ".." . Any one of these do not match "aaa", I think.
Sorry, I didn't understand your description very well. But let me show you why "aaa" match ".*".
We know "." can be any single character, then "" will allow us to repeat that "any sinlge character" or put nothing here. Therefore, "." can match the string consisted of repeated characters or no characters.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.