雷火电竞-中国电竞赛事及体育赛事平台

歡迎來到入門教程網(wǎng)!

vb

當(dāng)前位置:主頁 > 軟件編程 > vb >

VBS教程:方法-Execute 方法

來源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:vb|點(diǎn)擊:

Execute 方法

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

object.Execute(string)

參數(shù)

object

必選項(xiàng)。總是一個(gè) RegExp 對象的名稱。

string

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

說明

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

Execute 方法返回一個(gè) Matches 集合,其中包含了在 string 中找到的每一個(gè)匹配的 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 = RetStrEnd FunctionMsgBox(RegExpTest("is.", "IS1 is2 IS3 is4"))

上一篇:VBS教程:VBscript屬性-Length 屬性

欄    目:vb

下一篇:VBS教程:VBscript屬性-HelpContext 屬性

本文標(biāo)題:VBS教程:方法-Execute 方法

本文地址:http://www.jygsgssxh.com/a1/vb/8140.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有