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

            <2011年6月>
            2930311234
            567891011
            12131415161718
            19202122232425
            262728293012
            3456789

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            久久亚洲美女精品国产精品| 久久综合九色综合欧美就去吻 | 久久综合丁香激情久久| 久久久久久久久久久久久久| 久久亚洲AV无码西西人体| 国产成人久久久精品二区三区| 久久婷婷成人综合色综合| 人妻无码αv中文字幕久久琪琪布| 久久久久久久综合日本| 久久人人爽人人爽人人片AV麻豆| 国产精品九九久久免费视频| 久久最新精品国产| 91久久精品视频| 久久久久香蕉视频| 亚洲?V乱码久久精品蜜桃| 欧美久久久久久| 久久久精品2019免费观看| 久久国产色AV免费看| 久久久久一区二区三区| 精品久久久久久久久久中文字幕| 久久伊人中文无码| 青青草原综合久久大伊人| 人妻精品久久久久中文字幕一冢本| 久久66热人妻偷产精品9| 久久夜色tv网站| 久久99热这里只频精品6| 日韩人妻无码精品久久免费一| 国产精品久久国产精品99盘 | 国产精品一区二区久久精品无码| 久久人妻少妇嫩草AV无码蜜桃| 久久精品国产清自在天天线| 九九久久自然熟的香蕉图片| 欧美性大战久久久久久| 久久亚洲私人国产精品| 欧美伊人久久大香线蕉综合69| 亚洲国产精品无码久久久不卡| 精品综合久久久久久88小说| 人妻精品久久无码区| 日本久久中文字幕| 99国产欧美久久久精品蜜芽| 久久亚洲精品无码VA大香大香|