vs 2008 BOOST 正则IP地址与域名

CString plugclass::strDeelx(CString strurl, CString strBools) { CString in = NULL; wregex express(strBools); wsmatch result; std::wstring szBuf(strurl); std::wstring::const_iterator _start= szBuf.begin(); std::wstring::const_iterator _end= szBuf.end(); if(regex_search(_start,_end,result, express)) { std::wstring ret(result[0].first,result[0].second); in = (CString)ret.c_str(); _start = result[0].second; return in; } return in; }


#include
using namespace std::tr1;
using namespace Json;
using namespace std;


调用方法:
CString m_urls("www.baidu.com");

strDeelx(m_urls,_T("\\b[a-zA-z]+\\.[a-zA-Z]+\\.[a-zA-z]+\\b"));


m_urls = L"192.168.0.100";

【vs 2008 BOOST 正则IP地址与域名】strDeelx(m_urls,_T("\\b(([1]?\\d?\\d|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d?\\d|2[0-4]\\d|25[0-5])\\b"));

    推荐阅读