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


Execute 方法

對指定的字符串執(zhí)行正則表達式搜索。

object.Execute(string)

參數(shù)

object

必選項。總是一個 RegExp 對象的名稱。

string

必選項。要在其上執(zhí)行正則表達式的文本字符串。

說明

正則表達式搜索的設(shè)計模式是通過 RegExp 對象的 Pattern 來設(shè)置的。

Execute 方法返回一個 Matches 集合,其中包含了在 string 中找到的每一個匹配的 Match 對象。如果未找到匹配,Execute 將返回空的 Matches 集合。

下面的代碼說明了 Execute 方法的用法。

Function RegExpTest(patrn, strng)
  Dim regEx, Match, Matches      ' Create variable.
  Set regEx = New RegExp         ' Create a regular expression.
  regEx.Pattern = patrn         ' Set pattern.
  regEx.IgnoreCase = True         ' Set case insensitivity.
  regEx.Global = True         ' Set global applicability.
  Set Matches = regEx.Execute(strng)   ' Execute search.
  For Each Match in Matches      ' Iterate Matches collection.
    RetStr = RetStr & "Match 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"))

要求

版本 5

請參閱

Replace 方法 | Test 方法

應(yīng)用于: RegExp 對象