• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天下

            記錄修行的印記

            vc2010 tr1 regexp 小試

            #include "stdafx.h"
            #include 
            <regex>
            #include 
            <iostream>
            #include 
            <string>
            #include 
            <map>
            using namespace std;

            int main(int argc, char* argv[])
            {

                
            // 正則替換
                puts("//c++ 0x regex_replace()");
                
            string str = "Hello 333world";
                tr1::regex rx(
            "\\d+world");
                
            string replacement = "planet";
                
            string str2 = tr1::regex_replace(str, rx, replacement);
                cout 
            << "result:" << str2 << endl;
                
                
            // map + auto
                puts("\r\n//map + auto");
                map
            <stringstring> m;
                m[
            "aaa"= "a111111";
                m[
            "bbb"= "b22222";
                m[
            "ccc"= "c33333";
                
            for(auto i = m.begin(); i != m.end(); i++
                {
                    cout 
            << i->first << i->second << endl;
                }
                
                
            // c++ 0x regex_match()
                puts("\r\n//c++ 0x regex_match() ");
                
            const regex p("(\\w+) \\w+ (\\d+) \\w+ (\\d+).*");
                
            char *= "aaa bbb 333 eee 555";
                cmatch re;
                
            bool ret = regex_match(s, re, p);
                
            //if (ret)
                {
                    
            string t;
                    
            for(auto i = re.begin(); i != re.end(); i++)
                    {
                        t 
            = i->first;
                        t 
            = t.substr(0, i->second - i->first);
                        cout 
            << t << endl;
                    }
                }
                
            // c++ 0x regex_search()
                puts("\r\n//c++ 0x regex_search()");
                
            char *s2 = "hello world. 123";
                regex p2(
            "\\d+", tr1::regex_constants::icase);
                cmatch re2;
                regex_search(s2, re2, p2);
                cout 
            << "Matched \""  << re2.str()     
                << "\" after \"" << re2.prefix()     
                
            << "\" at offset: " << re2.position()     
                << " with length: " << re2.length()
                
            << endl; 
                
                
                cout 
            << tr1::regex r"(Hello "world")"


                getchar();

                
            return 0;
            }

            posted on 2012-05-15 14:00 天下 閱讀(611) 評論(0)  編輯 收藏 引用 所屬分類: Win32

            <2016年6月>
            2930311234
            567891011
            12131415161718
            19202122232425
            262728293012
            3456789

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            99久久国产精品免费一区二区| 久久久久高潮毛片免费全部播放 | 日韩亚洲欧美久久久www综合网 | 久久99精品免费一区二区| 久久精品中文字幕第23页| 久久夜色精品国产噜噜亚洲a | 国产精品热久久无码av| 久久免费观看视频| 日韩精品无码久久久久久| 亚洲嫩草影院久久精品| 人人狠狠综合88综合久久| 亚洲人成网亚洲欧洲无码久久| 久久电影网一区| 久久久久久久91精品免费观看| 久久精品国产久精国产| 国产69精品久久久久APP下载| 久久九九全国免费| 久久棈精品久久久久久噜噜| 久久久艹| 久久强奷乱码老熟女网站| 99久久中文字幕| 伊人久久综合无码成人网| 精品免费久久久久国产一区| 亚洲AV成人无码久久精品老人| 精品久久久久久无码中文野结衣| 中文字幕人妻色偷偷久久 | 国产精品久久亚洲不卡动漫| 久久久久国产精品嫩草影院| 亚洲国产成人久久综合野外| 亚洲国产二区三区久久| 久久99精品久久久久久久久久| 久久九九久精品国产免费直播| 久久久久99精品成人片三人毛片 | 成人国内精品久久久久影院VR| 激情伊人五月天久久综合| 午夜精品久久久久久中宇| 欧美伊人久久大香线蕉综合| 日本WV一本一道久久香蕉| 久久综合久久综合亚洲| 中文国产成人精品久久不卡| 日产精品久久久久久久|