Jafe Lee

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            49 隨筆 :: 0 文章 :: 24 評論 :: 0 Trackbacks
          <2007年12月>
          2526272829301
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345

          常用鏈接

          留言簿(5)

          隨筆分類(50)

          隨筆檔案(46)

          文章分類

          搜索

          最新評論

          評論排行榜


          1、Java 正則表達式中的Quantifiers(量詞)使用來指定匹配字符出現的次數的,java api中有三種Quantifiers: greedy, reluctant, and possessive。雖然三種quantifiers的作用很相似(見下表),但是三者還是有區別的。(摘自java.sun.com

          Quantifiers
          ?Meaning
          ?Greedy ?Reluctant ?Possessive
          ?X? ?X?? ?X?+ ?X, once or not at all
          ?X* ?X*? ?X*+ ?X, zero or more times
          ?X+ ?X+? ?X++ ?X, one or more times
          ?X{n} ?X{n}? ?X{n}+ ?X, exactly n times
          ?X{n,} ?X{n,}? ?X{n,}+ ?X, at least n times
          ?X{n,m} ?X{n,m}? ?X{n,m}+ ?X, at least n but not more than m times


          2、幾個例子(摘自 java.sun.com
          • greedy quantifiers
          • Zero-Length Matches (1)
          • Zero-Length Matches (2)
          • Zero-Length Matches (3)
          • exactly n number of times
          • at least n times
          • an upper limit
          • Capturing Groups with Quantifiers
          • Character Class with Quantifiers

          posted on 2007-12-10 22:35 Jafe Lee 閱讀(665) 評論(2)  編輯  收藏

          評論

          # re: Java 正則表達式 (3) -- Quantifiers 2007-12-12 19:17 jeasonzhao
          展開代碼的時候有JS錯誤  回復  更多評論
            

          # re: Java 正則表達式 (3) -- Quantifiers 2007-12-12 20:41 Jafe
          @jeasonzhao
          我用firefox沒什么問題啊~
          其實這些在 java.sun.com上都有的,我也只是copy過來而已~  回復  更多評論
            


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 昆山市| 台北县| 宜君县| 新沂市| 太湖县| 同江市| 达日县| 关岭| 岳普湖县| 合肥市| 台江县| 成武县| 体育| 泰来县| 隆尧县| 南涧| 佛教| 蒙城县| 新龙县| 宜宾市| 承德市| 晋城| 福州市| 拜泉县| 东城区| 博白县| 汕尾市| 石渠县| 高唐县| 吴江市| 小金县| 天镇县| 波密县| 普兰店市| 永寿县| 台前县| 德钦县| 卢湾区| 广河县| 耿马| 清苑县|