match_all_full


Description:

public bool match_all_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, out MatchInfo match_info = null) throws RegexError

Using the standard algorithm for regular expression matching only the longest match in the string is retrieved, it is not possible to obtain all the available matches.

For instance matching "<a> <b> <c>" against the pattern "<.*>" you get "<a> <b> <c>".

This function uses a different algorithm (called DFA, i.e. deterministic finite automaton), so it can retrieve all the possible matches, all starting at the same point in the string. For instance matching "<a> <b> <c>" against the pattern "<.*>;" you would obtain three matches: "<a> <b> <c>", "<a> <b>" and "<a>".

The number of matched strings is retrieved using get_match_count. To obtain the matched strings and their position you can use, respectively, fetch and fetch_pos. Note that the strings are returned in reverse order of length; that is, the longest matching string is given first.

Note that the DFA algorithm is slower than the standard one and it is not able to capture substrings, so backreferences do not work.

Setting start_position differs from just passing over a shortened string and setting g_regex_match_notbol in the case of a pattern that begins with any kind of lookbehind assertion, such as "\b".

Unless g_regex_raw is specified in the options, string must be valid UTF-8.

A MatchInfo structure, used to get information on the match, is stored in match_info if not null. Note that if match_info is not null then it is created even if the function returns false, i.e. you must free it regardless if regular expression actually matched.

string is not copied and is used in MatchInfo internally. If you use any MatchInfo method (except g_match_info_free) after freeing or modifying string then the behaviour is undefined.

Parameters:

this

a Regex structure from Regex

string_len

the length of string, in bytes, or -1 if string is nul-terminated

start_position

starting index of the string to match, in bytes

match_options

match options

match_info

pointer to location where to store the MatchInfo, or null if you do not need it

string

the string to scan for matches

Returns:

true is the string matched, false otherwise