64,648
社区成员
发帖
与我相关
我的任务
分享
#define BOOST_HAS_ICU
#include <iostream>
#include <boost/regex.hpp>
#include <boost/regex/icu.hpp>
//网上随便找的例子
std::string get_filename(const std::string& path)
{
boost::u32regex r = boost::make_u32regex("(?:\\A|.*\\\\)([^\\\\]+)");
boost::smatch what;
if(boost::u32regex_match(path, what, r))
{
// extract $1 as a CString:
return what.str(1);
}
else
{
throw std::runtime_error("Invalid pathname");
}
}
int _tmain(int argc, _TCHAR* argv[])
{
std::string str = get_filename("a123.bmp");
return 0;
}
#define BOOST_HAS_ICU
#include <iostream>
#include <boost/regex.hpp>
#include <boost/regex/icu.hpp>
#pragma comment(lib, "icuuc.lib")
#pragma comment(lib, "icuin.lib")
#pragma comment(lib, "icudt.lib")
//。。。
boost::u32regex r = boost::make_u32regex("(?:\\A|.*\\\\)([^\\\\]+)");