Implement regular expression matching with support for '.'
and '*'
.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const char *p)
Some examples:
isMatch("aa","a") → false
isMatch("aa","aa") → true
isMatch("aaa","aa") → false
isMatch("aa", "a*") → true
isMatch("aa", ".*") → true
isMatch("ab", ".*") → true
isMatch("aab", "c*a*b") → true
比较难,没看太明白,回头再思考
参考链接:
http://blog.csdn.net/doc_sgl/article/details/12719761
http://blog.csdn.net/pickless/article/details/9043389
http://leetcode.com/2011/09/regular-expression-matching.html
http://www.cnblogs.com/codingmylife/archive/2012/10/05/2712561.html
http://blog.csdn.net/sunbaigui/article/details/8981245