boost的regex无法匹配数字.换行?
regex regstr;
regstr= "</p>(?<content>\\d*?)<p";
//regstr="(?<content>dsa*?)";
// CString st=Get("http://www.discuz.net/archiver/?tid-1423782.html");
string testString(":45</p>沙发支持323·2!!<p ");
boost::smatch what;
string::const_iterator beg=testString.begin();
string::const_iterator end=testString.end();
while(regex_search(beg,end, what, regstr) )
{
std::cout<< "Name:" <<what["content"].str() << std::endl;
beg=what[0].second;
}regstr= "</p>(?<content>\\d*?)<p";
换成regstr= "</p>(?<content>\d*?)<p";也不行.晕...
如何换行了.类似于.
(":45</p>沙发支
持323·2!!<p
也匹配不出<p>里的内容..晕啊...
...全文
相关推荐
boost. regex
#### 四、贪婪匹配与非贪婪匹配在Boost.Regex中,默认使用贪婪匹配,即尽可能多地匹配字符。可以通过在量词后加上`?`来实现非贪婪匹配。
VS2008下编译好的Boost的regex库
Boost库中的regex库是专门用于处理正则表达式的组件,提供了强大的文本模式匹配和搜索功能。
boost.regex
, "Number $1", boost::match_default | boost::format_all); ``` 这将把找到的数字用"Number 数字"的形式替换。
C++Boost的Regex库用法
正则表达式(Regular Expressions),简称regex,是一种文本模式,包括普通字符(例如,每个字母和数字)和特殊字符(称为"元字符")。
Boost.Regex.C++正则表达式快速入门
`:匹配任意一个字符(默认情况下也包括换行符)。通过设置`match_not_dot_null`或`match_not_dot_newline`选项可以排除对空字符或换行符的匹配。3.


界面
