VC7で、正規表現を使いたいと思って調べてみたら、ATLでサポートされているんですね。
サンプルもMSDNに載っていて、簡単そうだし。
でも、正規表現の表現方法って、どうしてライブラリごとに違うんだろうか??
似通ってはいるけど、ライブラリごとに少しずつ違う。
とりあえず、テスト的なコードで動作を確認。
#include <atlrx.h>
...(中略)...
CAtlRegExp<> regex;
REParseError status = regex.Parse("^[0-9]+$");
if (REPARSE_ERROR_OK != status)
{
AfxMessageBox("Parse Error!");
return;
}
CAtlREMatchContext<> match;
if(regex.Match("0123", &match))
{
AfxMessageBox("Match!");
}
else
{
AfxMessageBox("Miss match!");
}
return;