text and a pattern pattern. Besides ordinary letters, the pattern may contain two special characters:
- ? stands for exactly one character, any character;
- * stands for any sequence of characters, including the empty one.
An ordinary letter in the pattern matches only itself. The pattern must describe the whole string, not just a part of it.
Return True if text fits pattern and False otherwise.text='report', pattern='r*t' → True
The star takes "epor", and the first and last letters match.
text='cat', pattern='c?' → False
The pattern describes exactly two letters, while the word has three.
text='', pattern='**' → True
Each star may stand for the empty string.
text.length, pattern.length ≤ 2000text consists of lowercase English letters onlypattern consists of lowercase English letters, ? and *text='report', pattern='r*t'
True
Run checks the first 3 tests in your browser. Submit checks all 209 tests on the server, hidden ones included.