Regular Expression Matching in String

Given a text and a pattern, evaluate the pattern to see if it matches the text by using regular expression matching.

Statement

Given a text and a pattern, determine if the pattern matches the text completely or not at all by using regular expression matching. For simplicity, assume that the pattern may contain only two operators: . and *.

* operator in the pattern means that the character preceding * may not appear or may appear any number of times in the text. The . operator matches with any character in the text exactly once.

Example

Below is an example of a text and its matching and non-matching patterns:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.