Regex
A GRegex
is the "compiled" form of a regular expression pattern.
GRegex
implements regular expression pattern matching using syntax and semantics similar to Perl regular expression. See the man:pcrepattern(3) for the syntax definition.
Some functions accept a @start_position argument, setting it 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. For example, consider the pattern "\Biss\B" which finds occurrences of "iss" in the middle of words. ("\B" matches only if the current position in the subject is not a word boundary.) When applied to the string "Mississipi" from the fourth byte, namely "issipi", it does not match, because "\B" is always false at the start of the subject, which is deemed to be a word boundary. However, if the entire string is passed , but with
Since
2.14
Constructors
Functions
Returns the number of capturing subpatterns in the pattern.
Returns the compile options that @regex was created with.
Checks whether the pattern contains explicit CR or LF references.
Returns the match options that @regex was created with.
Returns the number of the highest back reference in the pattern, or 0 if the pattern does not contain back references.
Gets the number of characters in the longest lookbehind assertion in the pattern. This information is useful when doing multi-segment matching using the partial matching facilities.
Gets the pattern string associated with @regex, i.e. a copy of the string passed to g_regex_new().
Retrieves the number of the subexpression named @name.
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.