#include <iostream>
#include <regex>
using namespace std;
int main() {
string p(“[^c]ei”);
p=”[[:alpha:]]*”+p+”[[:alpha:]]*”;
regex r(p,regex::icase);
string text=”receipt freind theif cei receive”;
for(sregex_iterator it(text.begin(),text.end(),r),end_it;it!=end_it;++it)
cout<<it->str()<<endl;
return 0;
}
运行结果是:
freind
theif
ceive
正确结果应该是:
freind
theif
问题在哪里?
#include <regex>
using namespace std;
int main() {
string p(“[^c]ei”);
p=”[[:alpha:]]*”+p+”[[:alpha:]]*”;
regex r(p,regex::icase);
string text=”receipt freind theif cei receive”;
for(sregex_iterator it(text.begin(),text.end(),r),end_it;it!=end_it;++it)
cout<<it->str()<<endl;
return 0;
}
运行结果是:
freind
theif
ceive
正确结果应该是:
freind
theif
问题在哪里?
解决方案
1
10
重现不能…
用的什么环境?
用的什么环境?
5
用vc14的库和NDK 12b的libc++库貌似都是正常的…
3
同,无法重现
1
make clean
make
make