1,配置vs2005的控制台编译环境 (参考
这里)
2,cd %Boost%/libs/regex/build
cmd>nmake -fvc80.mak
3,添加%Boost%到vs2005的include目录;添加%Boost%/libs/regex/build/vc80到library目录
4,测试
2,cd %Boost%/libs/regex/build
cmd>nmake -fvc80.mak
3,添加%Boost%到vs2005的include目录;添加%Boost%/libs/regex/build/vc80到library目录
4,测试
// 正規表示法測試:信用卡號檢測 #include <boost/regex.hpp> #include <iostream> bool validate_card_format(const std::string s) { static const boost::regex e("(//d{4}[- ]){3}//d{4}"); return regex_match(s, e); } int _tmain(int argc, _TCHAR* argv[]) { std::cout << (validate_card_format("1111-1111-1111-2222")?"PASS":"Error") ; // PASS return 0; } |