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

            鏈接

            最新隨筆

            搜索

            最新評論

            成人久久久观看免费毛片| 四虎影视久久久免费| 久久精品国产亚洲AV高清热| 99久久精品国产一区二区| 久久精品国产精品青草| 久久国内免费视频| 成人国内精品久久久久影院| 欧美日韩精品久久久免费观看| 天天躁日日躁狠狠久久 | 欧美大战日韩91综合一区婷婷久久青草| 国产69精品久久久久9999| 精品国产日韩久久亚洲| 欧美一区二区精品久久| 精品久久久久久国产| 久久91这里精品国产2020| 奇米影视7777久久精品| 人人狠狠综合久久亚洲| 99久久婷婷国产一区二区| 性高湖久久久久久久久| 久久强奷乱码老熟女| 热久久国产精品| 久久夜色精品国产噜噜噜亚洲AV| 一本大道久久东京热无码AV | 久久久久久精品成人免费图片| 99久久无色码中文字幕| 99久久国产宗和精品1上映| 久久99国产精品久久99小说| 久久国产视屏| 美女久久久久久| 午夜精品久久久久成人| 久久久久人妻一区精品| 国产三级观看久久| 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲 | 久久精品免费一区二区| 日本WV一本一道久久香蕉| 无码人妻少妇久久中文字幕| 久久久久人妻精品一区三寸蜜桃 | 欧美久久综合性欧美| 青青草原1769久久免费播放| 久久er国产精品免费观看2| 国产欧美久久一区二区|