# Global
{: .no_toc }

Returns or sets whether all matches are used, or only the first.

## Get

Returns a **Boolean**.

Syntax: *object*.**Global**

*object*
: *required* An object expression that evaluates to a **RegExp**.

The default value is **False**.

## Let

Sets the value.

Syntax: *object*.**Global** **=** *value*

*value*
: A **Boolean**. **True** makes [**Execute**](/tB/Packages/Contributed/tbRegExp/RegExp/Execute.md) return every match, [**Replace**](/tB/Packages/Contributed/tbRegExp/RegExp/Replace.md) replace every match, and [**Split**](/tB/Packages/Contributed/tbRegExp/RegExp/Split.md) split at every match. **False** makes each of them use only the first match.

## Remarks

[**Test**](/tB/Packages/Contributed/tbRegExp/RegExp/Test.md) does not depend on the value, because it only reports whether a match exists.

The value is applied when a match is made. Changing it does not compile the pattern again. The flag `g` of [**Flags**](/tB/Packages/Contributed/tbRegExp/RegExp/Flags.md) reads and sets the same value.

## Example

```tb check_build check_run
Dim re As RegExp
Set re = New RegExp
re.Pattern = "\d+"

Debug.Print re.Execute("a1b22c333").Count  ' 1
Debug.Print re.Replace("a1b22c333", "#")    ' a#b22c333

re.Global = True
Debug.Print re.Execute("a1b22c333").Count  ' 3
Debug.Print re.Replace("a1b22c333", "#")    ' a#b#c#
```

## See Also

- [Flags](/tB/Packages/Contributed/tbRegExp/RegExp/Flags.md) property -- sets this option with the letter `g`
- [Execute](/tB/Packages/Contributed/tbRegExp/RegExp/Execute.md) method -- returns the matches
- [Replace](/tB/Packages/Contributed/tbRegExp/RegExp/Replace.md) method -- replaces the matches
- [Split](/tB/Packages/Contributed/tbRegExp/RegExp/Split.md) method -- splits a string at the matches
- [RegExp](/tB/Packages/Contributed/tbRegExp/RegExp/index.md) class -- overview
