Name

RegExp.Global Property

Data Type

Boolean

Description

Determines whether the search for a pattern string should match all occurrences in the search string or just the first one.

Rules at a Glance

A search will attempt to locate only the first occurrence of the pattern string in a search string; that is, the default value of the Global property is False. If you want to search for all occurrences of the pattern string in the search string, you must set the Global property to True.

Programming Tips and Gotchas

If you’re interested only in determining whether the pattern string exists in the search string, there’s no point in overriding the Global property’s default value of False.

Get VBScript in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.