欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp match正則函數(shù)使用Matchs實(shí)例

 更新時(shí)間:2008年08月03日 15:50:21   作者:  
asp matchs函數(shù)提供了對(duì)正則表達(dá)式匹配的只讀屬性的訪問。一直都用這個(gè)函數(shù),沒想到本站竟然沒有這類文章,汗一個(gè),最近我會(huì)多加一些這樣的文章


  說明   
  Match   對(duì)象只能通過   RegExp   對(duì)象的   Execute   方法來創(chuàng)建,該方法實(shí)際上返回了   Match   對(duì)象的集合。所有的   Match   對(duì)象屬性都是只讀的。   
  在執(zhí)行正則表達(dá)式時(shí),可能產(chǎn)生零個(gè)或多個(gè)   Match   對(duì)象。每個(gè)   Match   對(duì)象提供了被正則表達(dá)式搜索找到的字符串的訪問、字符串的長度,以及找到匹配的索引位置等。   

  下面的代碼說明了   Match   對(duì)象的用法:     

  Function   RegExpTest(patrn,   strng)   
      Dim   regEx,   Match,   Matches '   建立變量。   
      Set   regEx   =   New   RegExp '   建立正則表達(dá)式。   
      regEx.Pattern   =   patrn '   設(shè)置模式。   
      regEx.IgnoreCase   =   True '   設(shè)置是否區(qū)分大小寫。   
      regEx.Global   =   True '   設(shè)置全局替換。   
      Set   Matches   =   regEx.Execute(strng) '   執(zhí)行搜索。   
      For   Each   Match   in   Matches '   遍歷   Matches   集合。   
          RetStr   =   RetStr   &   "Match   "   &   I   &   "   found   at   position   "   
          RetStr   =   RetStr   &   Match.FirstIndex   &   ".   Match   Value   is   "'   
          RetStr   =   RetStr   &   Match.Value   &   "'."   &   vbCRLF   
      Next   
      RegExpTest   =   RetStr   
  End   Function   

  MsgBox(RegExpTest("is.",   "IS1   is2   IS3   is4"))  

相關(guān)文章

最新評(píng)論