Regex GroupCount() Method

After calling Matches(), if the regex pattern used parenthesis to denote grouping, GroupCount() returns the number of groups.

Function Signature

 int GroupCount()

Parameters

Parameter Type Description

None

Return

Type Description

int

The number of groups.

Technical Details

SBM ModScript version: 11.3.

Example

var r = Regex();
r.Compile("(\\d+)[^\\d]*(\\d+)");
r.Matches("12ab3d456e78");
Ext.WriteStream( r.GroupCount() );

Result:

3

Notes

None.

Related Topics

Regex