Method
GLibMatchInfofetch_pos
since: 2.14
Declaration [src]
gboolean
g_match_info_fetch_pos (
const GMatchInfo* match_info,
gint match_num,
gint* start_pos,
gint* end_pos
)
Description [src]
Retrieves the position in bytes of the match_num
‘th capturing
parentheses. 0 is the full text of the match, 1 is the first
paren set, 2 the second, and so on.
If match_num
is a valid sub pattern but it didn’t match anything
(e.g. sub pattern 1, matching “b” against “(a)?b”) then start_pos
and end_pos
are set to -1 and TRUE
is returned.
As end_pos
is set to the byte after the final byte of the match (on success),
the length of the match can be calculated as end_pos - start_pos
.
If the match was obtained using the DFA algorithm, that is using
g_regex_match_all()
or g_regex_match_all_full(), the retrieved
position is not that of a set of parentheses but that of a matched
substring. Substrings are matched in reverse order of length, so
0 is the longest match.
Available since: 2.14
Parameters
match_num
-
Type:
gint
Number of the sub expression.
start_pos
-
Type:
gint*
Pointer to location where to store the start position, or
NULL
.The argument will be set by the function. The argument can be NULL
. end_pos
-
Type:
gint*
Pointer to location where to store the end position (the byte after the final byte of the match), or
NULL
.The argument will be set by the function. The argument can be NULL
.