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

            <2011年11月>
            303112345
            6789101112
            13141516171819
            20212223242526
            27282930123
            45678910

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            国产精品免费久久久久影院| 久久久久波多野结衣高潮| 久久天天躁狠狠躁夜夜avapp | 国内精品伊人久久久久影院对白| 人人狠狠综合久久亚洲88| 久久精品亚洲欧美日韩久久| 人人妻久久人人澡人人爽人人精品| 九九精品99久久久香蕉| 久久噜噜久久久精品66| 国产亚洲色婷婷久久99精品| 久久精品成人一区二区三区| 亚洲精品高清国产一线久久| 久久精品无码一区二区三区免费| 久久久久久九九99精品| 久久久久一级精品亚洲国产成人综合AV区| 国产精品成人久久久| 青青草原综合久久| 中文字幕日本人妻久久久免费| a级毛片无码兔费真人久久| 无遮挡粉嫩小泬久久久久久久| 久久久久这里只有精品| 国产精品视频久久| 亚洲精品国产美女久久久| 日日狠狠久久偷偷色综合免费| 色综合久久88色综合天天| 久久久亚洲欧洲日产国码二区 | 久久国产精品久久国产精品| 中文精品久久久久人妻不卡| 婷婷久久综合| 久久人人爽人人爽人人爽| 亚洲精品国产综合久久一线| 久久精品国产亚洲AV不卡| 国产成人久久精品二区三区| 99久久国产主播综合精品| 久久亚洲国产午夜精品理论片| 潮喷大喷水系列无码久久精品| 精品久久久久久久无码| 久久96国产精品久久久| 欧美精品一本久久男人的天堂| 久久er国产精品免费观看2| 91久久成人免费|