• <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 天下 閱讀(612) 評論(0)  編輯 收藏 引用 所屬分類: Win32

            <2012年5月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            日本久久中文字幕| 区亚洲欧美一级久久精品亚洲精品成人网久久久久| 亚洲国产天堂久久久久久| 人妻无码久久精品| 久久午夜伦鲁片免费无码| 亚洲狠狠综合久久| 亚洲日本久久久午夜精品| 久久精品人人做人人爽97| 久久精品国产精品亚洲人人 | 久久97精品久久久久久久不卡| 97久久精品人人澡人人爽| 久久久久久极精品久久久| 久久亚洲欧美国产精品| 思思久久99热免费精品6| 久久久青草久久久青草| 少妇久久久久久久久久| 四虎亚洲国产成人久久精品| 99久久精品国内| 狠狠色综合网站久久久久久久高清 | 欧美日韩中文字幕久久久不卡| 色欲久久久天天天综合网| 久久青青草原精品国产不卡| 狠狠色婷婷综合天天久久丁香| 久久亚洲中文字幕精品一区| 久久久久免费视频| 久久综合欧美成人| 久久国产一区二区| 亚洲色大成网站WWW久久九九| 国产成人综合久久精品红| 色婷婷综合久久久久中文字幕 | 精品国产乱码久久久久软件 | 久久人人爽人人爽人人片AV不| 亚洲国产日韩综合久久精品| 久久影视综合亚洲| 欧美久久久久久精选9999| 久久香蕉国产线看观看猫咪?v| 青青青国产精品国产精品久久久久 | 韩国三级中文字幕hd久久精品 | 97精品依人久久久大香线蕉97 | 久久精品国产精品亚洲精品| 久久久精品波多野结衣|