class_regexmatch.rst 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/modules/regex/doc_classes/RegExMatch.xml.
  6. .. _class_RegExMatch:
  7. RegExMatch
  8. ==========
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Contains the results of a :ref:`RegEx<class_RegEx>` search.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +---------------------------------------------------+---------------------------------------------------+-------------------------+
  21. | :ref:`Dictionary<class_Dictionary>` | :ref:`names<class_RegExMatch_property_names>` | ``{}`` |
  22. +---------------------------------------------------+---------------------------------------------------+-------------------------+
  23. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`strings<class_RegExMatch_property_strings>` | ``PackedStringArray()`` |
  24. +---------------------------------------------------+---------------------------------------------------+-------------------------+
  25. | :ref:`String<class_String>` | :ref:`subject<class_RegExMatch_property_subject>` | ``""`` |
  26. +---------------------------------------------------+---------------------------------------------------+-------------------------+
  27. .. rst-class:: classref-reftable-group
  28. Methods
  29. -------
  30. .. table::
  31. :widths: auto
  32. +-----------------------------+---------------------------------------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`get_end<class_RegExMatch_method_get_end>`\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| |
  34. +-----------------------------+---------------------------------------------------------------------------------------------------------------+
  35. | :ref:`int<class_int>` | :ref:`get_group_count<class_RegExMatch_method_get_group_count>`\ (\ ) |const| |
  36. +-----------------------------+---------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`get_start<class_RegExMatch_method_get_start>`\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| |
  38. +-----------------------------+---------------------------------------------------------------------------------------------------------------+
  39. | :ref:`String<class_String>` | :ref:`get_string<class_RegExMatch_method_get_string>`\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| |
  40. +-----------------------------+---------------------------------------------------------------------------------------------------------------+
  41. .. rst-class:: classref-section-separator
  42. ----
  43. .. rst-class:: classref-descriptions-group
  44. Property Descriptions
  45. ---------------------
  46. .. _class_RegExMatch_property_names:
  47. .. rst-class:: classref-property
  48. :ref:`Dictionary<class_Dictionary>` **names** = ``{}`` :ref:`🔗<class_RegExMatch_property_names>`
  49. .. rst-class:: classref-property-setget
  50. - :ref:`Dictionary<class_Dictionary>` **get_names**\ (\ )
  51. 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.
  52. .. rst-class:: classref-item-separator
  53. ----
  54. .. _class_RegExMatch_property_strings:
  55. .. rst-class:: classref-property
  56. :ref:`PackedStringArray<class_PackedStringArray>` **strings** = ``PackedStringArray()`` :ref:`🔗<class_RegExMatch_property_strings>`
  57. .. rst-class:: classref-property-setget
  58. - :ref:`PackedStringArray<class_PackedStringArray>` **get_strings**\ (\ )
  59. An :ref:`Array<class_Array>` of the match and its capturing groups.
  60. **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.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_RegExMatch_property_subject:
  64. .. rst-class:: classref-property
  65. :ref:`String<class_String>` **subject** = ``""`` :ref:`🔗<class_RegExMatch_property_subject>`
  66. .. rst-class:: classref-property-setget
  67. - :ref:`String<class_String>` **get_subject**\ (\ )
  68. The source string used with the search pattern to find this matching result.
  69. .. rst-class:: classref-section-separator
  70. ----
  71. .. rst-class:: classref-descriptions-group
  72. Method Descriptions
  73. -------------------
  74. .. _class_RegExMatch_method_get_end:
  75. .. rst-class:: classref-method
  76. :ref:`int<class_int>` **get_end**\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| :ref:`🔗<class_RegExMatch_method_get_end>`
  77. 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.
  78. Returns -1 if the group did not match or doesn't exist.
  79. .. rst-class:: classref-item-separator
  80. ----
  81. .. _class_RegExMatch_method_get_group_count:
  82. .. rst-class:: classref-method
  83. :ref:`int<class_int>` **get_group_count**\ (\ ) |const| :ref:`🔗<class_RegExMatch_method_get_group_count>`
  84. Returns the number of capturing groups.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_RegExMatch_method_get_start:
  88. .. rst-class:: classref-method
  89. :ref:`int<class_int>` **get_start**\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| :ref:`🔗<class_RegExMatch_method_get_start>`
  90. 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.
  91. Returns -1 if the group did not match or doesn't exist.
  92. .. rst-class:: classref-item-separator
  93. ----
  94. .. _class_RegExMatch_method_get_string:
  95. .. rst-class:: classref-method
  96. :ref:`String<class_String>` **get_string**\ (\ name\: :ref:`Variant<class_Variant>` = 0\ ) |const| :ref:`🔗<class_RegExMatch_method_get_string>`
  97. 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.
  98. Returns an empty string if the group did not match or doesn't exist.
  99. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  100. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  101. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  102. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  103. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  104. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  105. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  106. .. |void| replace:: :abbr:`void (No return value.)`