Contains the results of a regex search.
    public class RegExMatch : Reference

Contains the results of a single regex match returned by RegEx.Search(string, int, int) and RegEx.SearchAll(string, int, int). It can be used to find the position and range of the match and its capturing groups, and it can extract its sub-string for you.

Inheritance Chain

Constructors

    public RegExMatch()

Properties

    public Collections.Dictionary Names { get; }

A dictionary of named groups and its corresponding group number. Only groups with that were matched are included. If multiple groups have the same name, that name would refer to the first matching one.

    public Collections.Array Strings { get; }

An Array of the match and its capturing groups.

    public string Subject { get; }

The source string used with the search pattern to find this matching result.

Methods

    public int GetEnd(object name = null)

Returns the end position of the match within the source string. The end position of capturing groups can be retrieved by providing its group number as an integer or its string name (if it’s a named group). The default value of 0 refers to the whole pattern.

Returns -1 if the group did not match or doesn’t exist.

    public int GetGroupCount()

Returns the number of capturing groups.

    public Dictionary GetNames()

Getter for Names

    public int GetStart(object name = null)

Returns the starting position of the match within the source string. The starting position of capturing groups can be retrieved by providing its group number as an integer or its string name (if it’s a named group). The default value of 0 refers to the whole pattern.

Returns -1 if the group did not match or doesn’t exist.

    public string GetString(object name = null)

Returns the substring of the match from the source string. Capturing groups can be retrieved by providing its group number as an integer or its string name (if it’s a named group). The default value of 0 refers to the whole pattern.

Returns an empty string if the group did not match or doesn’t exist.

    public Godot.Collections.Array GetStrings()

Getter for Strings

    public string GetSubject()

Getter for Subject

Tags: