Boost :: xpressiveを使い始めたばかりで、優れたライブラリであることがわかりました...ドキュメントを調べて、!を使おうとしました。演算子(0または1)ですが、コンパイルされません(VS2008)。
「sip:」で始まる場合とそうでない場合があるsipアドレスを照合したい。
#include <iostream>
#include <boost/xpressive/xpressive.hpp>
using namespace boost::xpressive;
using namespace std;
int main()
{
sregex re = !"sip:" >> *(_w | '.') >> '@' >> *(_w | '.');
smatch what;
for(;;)
{
string input;
cin >> input;
if(regex_match(input, what, re))
{
cout << "match!\n";
}
}
return 0;
}`