Regex

class Regex(pointer: <Error class: unknown class><<Error class: unknown class>>) : Record

The g_regex_*() functions implement regular expression pattern matching using syntax and semantics similar to Perl regular expression.

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

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion : RecordCompanion<Regex, <Error class: unknown class>>

Properties

Link copied to clipboard
val glibRegexPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard

Returns the number of capturing subpatterns in the pattern.

Link copied to clipboard

Returns the compile options that @regex was created with.

Link copied to clipboard

Checks whether the pattern contains explicit CR or LF references.

Link copied to clipboard

Returns the match options that @regex was created with.

Link copied to clipboard

Returns the number of the highest back reference in the pattern, or 0 if the pattern does not contain back references.

Link copied to clipboard

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.

Link copied to clipboard

Gets the pattern string associated with @regex, i.e. a copy of the string passed to g_regex_new().

Link copied to clipboard

Retrieves the number of the subexpression named @name.

Link copied to clipboard
fun ref(): Regex

Increases reference count of @regex by 1.

Link copied to clipboard
fun split(string: String, matchOptions: RegexMatchFlags): List<String>

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.

Link copied to clipboard
fun unref()

Decreases reference count of @regex by 1. When reference count drops to zero, it frees all the memory associated with the regex structure.