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

            鏈接

            最新隨筆

            搜索

            最新評論

            亚洲国产另类久久久精品黑人| 天天躁日日躁狠狠久久| 色综合久久中文色婷婷| 精品久久久久久无码中文野结衣| 亚洲国产成人精品91久久久| 亚洲欧美成人综合久久久| 国产一级持黄大片99久久| 亚洲国产成人久久精品99 | 久久久久亚洲AV片无码下载蜜桃| 久久精品国产亚洲AV无码麻豆| 99久久精品免费看国产一区二区三区| 国产成人精品综合久久久| 777午夜精品久久av蜜臀| 99久久精品费精品国产| 久久狠狠爱亚洲综合影院| 国产成人无码精品久久久免费| 伊人久久大香线蕉综合网站| 久久青草国产精品一区| 久久亚洲精精品中文字幕| 欧美精品福利视频一区二区三区久久久精品| 99久久国产综合精品女同图片 | 精品久久久久成人码免费动漫| 久久96国产精品久久久| 久久婷婷人人澡人人爽人人爱 | 久久精品国产亚洲AV麻豆网站| 久久免费看黄a级毛片| 99久久精品免费看国产| 99久久精品国产麻豆| 久久水蜜桃亚洲av无码精品麻豆| 一个色综合久久| 四虎影视久久久免费观看| 久久久久亚洲AV无码专区网站 | 亚洲日本va午夜中文字幕久久| 国产精品内射久久久久欢欢| av无码久久久久不卡免费网站| 亚洲精品美女久久777777| 久久久噜噜噜久久中文字幕色伊伊 | 午夜精品久久久久久| 亚洲综合久久夜AV | 久久无码AV一区二区三区| 日本久久中文字幕|