提升库解析元字符和单词 [英] boost library parsing metacharacter and word

查看:56
本文介绍了提升库解析元字符和单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hai,
我如何使用Boost库分离元字符和单词.这是我的代码

代码:

hai,
how i can Separate meta characters and word using boost library.This my code

code:

boost::regex patternexpression("\\W+",boost::regex_constants::icase|boost::regex_constants::normal);
    std::string stringa ("Dear %1244,{Customerid:D}hfsduihui{Customerid:D}sd u");
    boost::sregex_token_iterator k(stringa.begin(), stringa.end(), patternexpression,0);
    boost::sregex_token_iterator l;


while(k != l)
    {
        std::string temp1 = *k;
        CString m_strConvertstring1(temp1.c_str());
        AfxMessageBox(m_strConvertstring1);
        k++;
    }


该代码仅在单词中拆分,并且如何拆分元字符
感谢您的进步


This code only split in word and how can split meta characters
Thanks for advance

推荐答案

这是解决方案代码

boost :: regex patternexpression("\\ w + | \\ W +",boost :: regex_constants :: icase | boost :: regex_constants :: normal);
This is solution code

boost::regex patternexpression("\\w+|\\W+",boost::regex_constants::icase|boost::regex_constants::normal);


这篇关于提升库解析元字符和单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆