30.正则匹配

思路:https://blog.csdn.net/qq_28410301/article/details/100182901

class Solution {
public:
    bool isMatch(string str, string pattern) {
        //递归结束
        if(str.empty() && pattern.empty())
            return true;
        
        //查看首元素是否一致
         bool first_match = !str.empty() && (str[0] == pattern[0] || pattern[0] == '.');
        
        //如果下一个字符带"*"
        if(pattern.size() >= 2 && pattern[1] == '*')
            return (bool) (isMatch(str,pattern.substr(2)) || (first_match && isMatch(str.substr(1),pattern)));
        else{
            return bool(first_match && isMatch(str.substr(1),pattern.substr(1)));
        }        
        
    }
};
带女朋友搬家新家条件不好,累到女朋友了,让女朋友受苦了,特此明志:每天学习,明年这个时候(20190812)让女朋友住上大房子,永远年轻,永远热泪盈眶,很多人都是这样,他们都把自己当成身在梦中一样,浑浑噩噩地过日子,只有痛苦或爱或危险可以让他们重新感到这个世界的真实。
原文地址:https://www.cnblogs.com/make-big-money/p/12508372.html