http://programmer-toy-box.sblo.jp/article/14267315.html
もしくは、
「C++ Boostのインストール(Windows + VisualC++ 2008編)」
http://programmer-toy-box.sblo.jp/article/14873765.html
でBoostがインストールされていることが前提です。
SJIS対応です。
#include <iostream>
#include <string>
#include <boost/regex.hpp>
using namespace std;
int main() {
boost::regex r5("^[0-9A-Za-z]+$");
boost::smatch m5;
string str5 = "abcdefghijklmnopqrstuvwxyz0123456789";
if( boost::regex_search(str5, m5, r5) ) {
cout << "すべて半角英数字である" << endl;
} else {
cout << "半角英数字でない文字がある" << endl;
}
return 0;
}