Return the 1‐based index of the named sub‐pattern, or ‐1.
Synopsis
Declared in <bdlpcre_regex.h>
int
subpatternIndex(char const* name) const;
Description
Return the 1‐based index of the sub‐pattern having the specified name in the pattern held by this regular‐expression object (pattern()); return ‐1 if pattern() does not contain a sub‐pattern identified by name or name is not unique. The behavior is undefined unless isPrepared() == true. Note that the returned value is intended to be used as an index into the bsl::vector<bsl::pair<int, int> > returned by match. Also note that the function namedSubpatterns can be used to find the sub‐pattern index when there are duplicate named sub‐patterns.
Return Value
1‐based sub‐pattern index, or ‐1 if not found or not unique
Parameters
Name |
Description |
name |
null‐terminated name of the sub‐pattern |
Created with MrDocs