123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/modules/regex/doc_classes/RegExMatch.xml.
- .. _class_RegExMatch:
- RegExMatch
- ==========
- **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- Contains the results of a :ref:`RegEx<class_RegEx>` search.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- Contains the results of a single :ref:`RegEx<class_RegEx>` match returned by :ref:`RegEx.search<class_RegEx_method_search>` and :ref:`RegEx.search_all<class_RegEx_method_search_all>`. It can be used to find the position and range of the match and its capturing groups, and it can extract its substring for you.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +---------------------------------------------------+---------------------------------------------------+-------------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`names<class_RegExMatch_property_names>` | ``{}`` |
- +---------------------------------------------------+---------------------------------------------------+-------------------------+
- | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`strings<class_RegExMatch_property_strings>` | ``PackedStringArray()`` |
- +---------------------------------------------------+---------------------------------------------------+-------------------------+
- | :ref:`String<class_String>` | :ref:`subject<class_RegExMatch_property_subject>` | ``""`` |
- +---------------------------------------------------+---------------------------------------------------+-------------------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +-----------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_end<class_RegExMatch_method_get_end>`\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| |
- +-----------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_group_count<class_RegExMatch_method_get_group_count>`\ (\ ) |const| |
- +-----------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_start<class_RegExMatch_method_get_start>`\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| |
- +-----------------------------+---------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_string<class_RegExMatch_method_get_string>`\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| |
- +-----------------------------+---------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_RegExMatch_property_names:
- .. rst-class:: classref-property
- :ref:`Dictionary<class_Dictionary>` **names** = ``{}`` :ref:`🔗<class_RegExMatch_property_names>`
- .. rst-class:: classref-property-setget
- - :ref:`Dictionary<class_Dictionary>` **get_names**\ (\ )
- A dictionary of named groups and its corresponding group number. Only groups that were matched are included. If multiple groups have the same name, that name would refer to the first matching one.
- .. rst-class:: classref-item-separator
- ----
- .. _class_RegExMatch_property_strings:
- .. rst-class:: classref-property
- :ref:`PackedStringArray<class_PackedStringArray>` **strings** = ``PackedStringArray()`` :ref:`🔗<class_RegExMatch_property_strings>`
- .. rst-class:: classref-property-setget
- - :ref:`PackedStringArray<class_PackedStringArray>` **get_strings**\ (\ )
- An :ref:`Array<class_Array>` of the match and its capturing groups.
- **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedStringArray<class_PackedStringArray>` for more details.
- .. rst-class:: classref-item-separator
- ----
- .. _class_RegExMatch_property_subject:
- .. rst-class:: classref-property
- :ref:`String<class_String>` **subject** = ``""`` :ref:`🔗<class_RegExMatch_property_subject>`
- .. rst-class:: classref-property-setget
- - :ref:`String<class_String>` **get_subject**\ (\ )
- The source string used with the search pattern to find this matching result.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_RegExMatch_method_get_end:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_end**\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| :ref:`🔗<class_RegExMatch_method_get_end>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_RegExMatch_method_get_group_count:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_group_count**\ (\ ) |const| :ref:`🔗<class_RegExMatch_method_get_group_count>`
- Returns the number of capturing groups.
- .. rst-class:: classref-item-separator
- ----
- .. _class_RegExMatch_method_get_start:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_start**\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| :ref:`🔗<class_RegExMatch_method_get_start>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_RegExMatch_method_get_string:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_string**\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| :ref:`🔗<class_RegExMatch_method_get_string>`
- 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.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|