The usage of Global attribute in VBS
This article focuses on "the use of Global attribute in VBS". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "the use of the Global attribute in VBS"!
Sets or returns a Boolean value indicating whether the pattern matches all or only the first one when searching for the entire string.
Object.Global [= True | False]
Object parameters are always RegExp objects. If the search is applied to the entire string, the value of the Global property is True, otherwise its value is False. The default setting is False.
Description
The following code illustrates the use of the Global property (changing the value assigned to the Global property and observing its effect):
Function RegExpTest (patrn, strng) Dim regEx, match,matches' create variables. Set regEx = New RegExp 'establishes the canonical expression. RegEx.Pattern = patrn 'sets the mode. RegEx.IgnoreCase = True 'sets whether letters are case sensitive. RegEx.Global = True 'sets the properties of the whole process. Set matches= regEx.Execute (strng) 'performs the search. For each match in matches' repeat matching set RetStr=RetStr& "Match found at position" RetStr=RetStr&Match.FirstIndex& ". Match Value is'" RetStr=RetStr&Match.Value& "." & vbCRLF NextRegExpTest=RetStrEnd FunctionMsgBox (RegExpTest ("is.", "IS1 is2 IS3 is4")) so far, I believe you have a deeper understanding of "the use of the Global attribute in VBS". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!