rendered paste body#include <iostream>bool matches(std::string ®ex, std::string &test_string){ int i=0, j=0; while(i<regex.length() && j<test_string.length()){ if(regex[i+1]=='*'){ while(test_string[j]==regex[i]){ j++; } i+=2; }else if(regex[i+1]=='?' ){ if(regex[i]==test_string[j]){ j++; } i+=2; }else if(regex[i]==test_string[j]){ i++; j++; }else{ break; } } return (i==regex.length() && j==test_string.length());}int main(int argc, char *argv[]){ std::cout<<std::boolalpha; std::string regex, test_string; std::cout<<"Enter the regular expression and test string."<<std::endl; std::cin>>regex>>test_string; std::cout<<"Expressions match : "<<matches(regex, test_string)<<std::endl; std::cin.get();}