10. Regular Expression Matching (9月11日)

来源:互联网 发布:兰州知豆电动车租赁app 编辑:程序博客网 时间:2024/06/12 19:01

‘.’ 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

先用最简单的方法
参考:
这里写链接内容

原创粉丝点击