• <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)

            鏈接

            最新隨筆

            搜索

            最新評論

            国产福利电影一区二区三区久久老子无码午夜伦不 | 大伊人青草狠狠久久| 伊人色综合久久天天人守人婷| 一97日本道伊人久久综合影院| 波多野结衣久久精品| 色欲久久久天天天综合网精品| 99久久精品国产麻豆| 久久97久久97精品免视看| 亚洲国产成人久久一区WWW| 亚洲国产精品无码久久SM| 国产精品久久精品| 久久久久无码专区亚洲av| 日韩精品久久无码人妻中文字幕 | 亚洲精品午夜国产va久久| 99精品久久精品一区二区| 国产高清国内精品福利99久久| 亚洲AV成人无码久久精品老人| 大美女久久久久久j久久| 亚洲日韩中文无码久久| 久久久久国产精品麻豆AR影院| 久久亚洲精品人成综合网| 久久综合视频网| 久久久久国色AV免费观看| 成人妇女免费播放久久久| 久久受www免费人成_看片中文| 99久久精品无码一区二区毛片| 亚洲午夜久久久影院伊人| 香蕉久久影院| 久久久久久毛片免费看| 伊人热人久久中文字幕| 精品无码久久久久国产| 亚洲中文字幕无码一久久区| 久久久久久久综合综合狠狠| 国产一区二区三精品久久久无广告 | 国产欧美久久久精品影院| 精品国产综合区久久久久久 | 久久综合九色综合网站| 国产精品久久久久久久app| 深夜久久AAAAA级毛片免费看| 久久综合九色综合欧美狠狠| 久久er热视频在这里精品|