isMatch("ab", ".*") → true


  • 0

    How come this test case is true ?

    as . will get matched to 'a' and then * as the description says, Matches zero or more of the preceding element. In this case that is 'a'(previously matched character), so '*' shouldn't get matched to b at all.

    isMatch("aa", ".*") = true, this test case makes the right sense, I believe.


  • 0
    C

    As far as I understand '*' after dot '.' indicates zero or more '.'. This is a common use case in regex to indicate arbitrary character in arbitrary length.


  • 0

    This means its logical interpretation is just '*' then.


Log in to reply
 

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