'\" t .\" Title: function::ngroups .\" Author: .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: November 2023 .\" Manual: A collection of standard string functions .\" Source: SystemTap Tapset Reference .\" Language: English .\" .TH "FUNCTION::NGROUPS" "3stap" "November 2023" "SystemTap Tapset Reference" "A collection of standard strin" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" function::ngroups \- Number of subexpressions in the last match\&. .SH "SYNOPSIS" .sp .nf ngroups:long() .fi .SH "ARGUMENTS" .PP None .SH "DESCRIPTION" .PP returns the number of subexpressions from the last successful use of the =~ regex matching operator\&. .PP Note that this number includes subexpressions which are present in the regex but did not match any string; for example, given the regex \(lqa|(b)\(rq, the subexpressions will count the group for (b) regardless of whether it matched a string or not\&. Throws an error if the last use of =~ was a failed match\&. .SH SEE ALSO\n .IR tapset::regex (3stap)