Property: Global for RegExp
- Updated2024-09-12
- 1 minute(s) read
Properties > Property: Global for RegExp
Property: Global for RegExp
Specifies, whether the search for the text pattern refers to the entire character string. If you assign FALSE to the Global property, the search only refers to the first time the text pattern appears within the character string.
Object.Global
| Object | RegExp Object with this property |
| Object.Global | Boolean with read and write access |
The following example replaces the text pattern bc in the entire character string:
Dim RegExpression, sText Set RegExpression = CreateObject("VBScript.RegExp") RegExpression.Pattern = "bc" RegExpression.Global = TRUE RegExpression.IgnoreCase = TRUE sText = RegExpression.Replace("abcABC","bcdef") Call MsgBox(sText) ' Returns abcdefAbcdef