Win32下的模式匹配

来源:互联网 发布:linux iso镜像下载64 编辑:程序博客网 时间:2024/06/15 18:42
#include <atlrx.h>#include <atlstr.h>/** * 此模式匹配用于匹配关键字中包含的*或者? * 有以下限制: * 关键字的第一个字符不能是*或者? * */ int PattenMatch(const wchar_t* aFullpath, const wchar_t* aPattern){        // five match groups: scheme, authority, path, query, fragment        CAtlRegExp<> reUrl;        //REParseError status = reUrl.Parse(L"({[^:/?#]+}:)?(//{[^/?#]*})?{[^?#]*}(?{[^#]*})?(#{.*})?");        REParseError status = reUrl.Parse(aPattern, false);        if (REPARSE_ERROR_OK != status)        {                // Unexpected error.                return -6002;        }        CAtlREMatchContext<> mcUrl;        //if (!reUrl.Match(L"http://search.microsoft.com/us/Search.asp?qu=atl&boolean=ALL#results", &mcUrl))        if (!reUrl.Match(aFullpath, &mcUrl))        {                // Unexpected error.                return -6002;        }        return 0;}

代码如上。
0 0
原创粉丝点击