Input: "a", "ab*"
Why this input has expected "true" answer? I think "ab*" equals to "ab", "abb", "abbb.......". So the output should be false. Can anyone explain why the expected answer is "true".
In this case, the "preceding element" is "b". So your input does not answer my question. Thanks.
Huh? How does that not answer your question? Yes, the preceding element is "b". So it also matches when there are zero "b", i.e., when the string is just "a". I don't see why you don't see that.
Ah, I guess I know now. You think there must be an "a", then there must be a "b", and then there must be zero or more "b", right? That's not how regular expressions work. The "*" kind of modifies the "b". It's not separate. You need to read "b*" as a single thing meaning zero or more "b".
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.