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

            <2016年2月>
            31123456
            78910111213
            14151617181920
            21222324252627
            282912345
            6789101112

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            久久久网中文字幕| 色婷婷综合久久久久中文| 精品久久久久久99人妻| 中文精品久久久久人妻| 亚洲色欲久久久综合网| 精品视频久久久久| 久久久无码精品亚洲日韩蜜臀浪潮| 青青草原综合久久大伊人精品| 狠狠色狠狠色综合久久| 国产精品女同一区二区久久| 久久免费国产精品一区二区| 久久久免费精品re6| 一本色道久久综合狠狠躁| 亚洲精品乱码久久久久66| 国产精品99久久免费观看| 国产精品久久自在自线观看| 久久综合久久久| 欧美日韩精品久久久久| 久久久久人妻一区二区三区| 久久夜色精品国产噜噜亚洲AV| 久久精品国产亚洲av麻豆小说| 精品少妇人妻av无码久久| 四虎国产精品免费久久久| 久久成人精品| 亚洲AV日韩精品久久久久久| 久久久久久午夜成人影院| 国产精品gz久久久| 无码国内精品久久综合88| av国内精品久久久久影院| 久久99精品久久久久久野外 | 久久久久se色偷偷亚洲精品av | 午夜精品久久久久久毛片| 久久国产精品久久精品国产| 国内精品久久久久久麻豆| 亚洲中文字幕无码久久2020| 久久青草国产精品一区| 日产精品久久久久久久| 久久精品国产亚洲一区二区| 噜噜噜色噜噜噜久久| 日本精品久久久中文字幕| 一本一本久久A久久综合精品 |