SBM ModScript Reference → Programming SBM ModScript → Object Types → Regex → Regex GroupVal() Method
After calling Matches(), if the regex pattern used parenthesis to denote grouping, this returns the group specified.
Parameter | Type | Description |
---|---|---|
group |
int |
Value 0 will return the full text matched by the regex; groups 1-n (see Regex GroupCount() Method) will return the groupings that the regex pattern identified using parentheses. |
Type | Description |
---|---|
string |
The specified group. |
SBM ModScript version: 11.3.
var r = Regex(); r.Compile("(\\d+)[^\\d]*(\\d+)"); r.Matches("12ab3d456e78"); for ( var i = 0; i < r.GroupCount(); ++i ) { Ext.WriteStream( r.GroupVal(i) ); }
Result:
12ab3 12 3
None.
Copyright © 2007–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.