Meta Messenger uses lightweight pattern rules in some internal filters. Implement a regular expression matcher that returns whether an entire input string matches a pattern.
The pattern supports only two special characters:
. matches any single character.* matches zero or more occurrences of the immediately preceding element.Your task is to implement full-string matching, not partial matching.
Write a function is_match(s, p) where:
s is a string to testp is a pattern stringTrue if p matches all of s, otherwise return FalseA * always applies to the character immediately before it. You may assume the pattern is valid.
Example 1
s = "aa", p = "a"Falsea, but the string has two.Example 2
s = "aa", p = "a*"Truea* can match two a characters.Example 3
s = "ab", p = ".*"True. matches any character and * allows repeating it.0 <= len(s) <= 200 <= len(p) <= 30s contains only lowercase English lettersp contains only lowercase English letters, . and *