The problem of regular expression (regex) matching has always fascinated computer scientists.
Regular expressions are patterns used to match character combinations in a string.
This article describes a solution to the problem of regex matching by using a bottom-up dynamic programming approach.
The solution uses a boolean 2D array to store the truth values and iterates through all the elements to fill the boolean array taking into account four possible conditions.
The time complexity of this solution is O(m*n) and the space complexity is also O(m*n).
An example is presented in the article to explain the solution in detail.
The final answer is true if the string matches the pattern.
This solution is implemented in C++.
Pattern and string can be matched using the implemented solution.
The code and output are well explained in the article with the help of images.