SBM ModScript Reference → Programming SBM ModScript → Object Types → Regex → Regex GroupCount() Method
After calling Matches(), if the regex pattern used parenthesis to denote grouping, GroupCount() returns the number of groups.
| Parameter | Type | Description |
|---|---|---|
|
None |
| Type | Description |
|---|---|
|
int |
The number of groups. |
SBM ModScript version: 11.3.
var r = Regex();
r.Compile("(\\d+)[^\\d]*(\\d+)");
r.Matches("12ab3d456e78");
Ext.WriteStream( r.GroupCount() );
Result:
3
None.
Copyright © 2007–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.