split_full


Description:

[ CCode ( array_length = false , array_null_terminated = true ) ]
public string[] split_full (string str, ssize_t string_len = -1, int start_position = 0, RegexMatchFlags match_options = 0, int max_tokens = 0) throws RegexError

Breaks the string on the pattern, and returns an array of the tokens.

If the pattern contains capturing parentheses, then the text for each of the substrings will also be returned. If the pattern does not match anywhere in the string, then the whole string is returned as the first token.

As a special case, the result of splitting the empty string "" is an empty vector, not a vector containing a single string. The reason for this special case is that being able to represent an empty vector is typically more useful than consistent handling of empty elements. If you do need to represent empty elements, you'll need to check for the empty string before calling this function.

A pattern that can match empty strings splits string into separate characters wherever it matches the empty string between characters. For example splitting "ab c" using as a separator "\s*", you will get "a", "b" and "c".

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".

Parameters:

this

a Regex structure

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 time option flags

max_tokens

the maximum number of tokens to split string into. If this is less than 1, the string is split completely

string

the string to split with the pattern

Returns:

a null-terminated gchar ** array. Free it using strfreev