Next: Message matching functions, Previous: Matching strings, Up: Functions [Contents][Index]
The following functions are used to retrieve actual content of a
captured group after a successive match. The match is identified
by match descriptor returned from a prior call to prce_match
or
pcre_string_match
.
These functions will raise the e_range
exception, if the match
descriptor is invalid, and the e_inval
exception, if the
substring number or name refer to a non-existing capturing group.
Returns text of the nth captured group of the match mh.
Returns text of the named captured group name in the match mh.
Given match descriptor mh, replace in input all references to capturing groups with their actual text and return the resulting string.
Numbered capturing groups are referred to as ‘$n’, where n is the group number (0-based, 0 being the portion of the text matching entire regular expression). If n is greater than 9, it should be enclosed in curly braces (e.g. ‘${10}’).
Named capturing groups are referred to as ‘$+{name}’, where name is the group name.