class_regexmatch.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the RegExMatch.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_RegExMatch:
  6. RegExMatch
  7. ==========
  8. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Contains the results of a regex search.
  13. Properties
  14. ----------
  15. +-------------------------------------+---------------------------------------------------+
  16. | :ref:`Dictionary<class_Dictionary>` | :ref:`names<class_RegExMatch_property_names>` |
  17. +-------------------------------------+---------------------------------------------------+
  18. | :ref:`Array<class_Array>` | :ref:`strings<class_RegExMatch_property_strings>` |
  19. +-------------------------------------+---------------------------------------------------+
  20. | :ref:`String<class_String>` | :ref:`subject<class_RegExMatch_property_subject>` |
  21. +-------------------------------------+---------------------------------------------------+
  22. Methods
  23. -------
  24. +-----------------------------+--------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`get_end<class_RegExMatch_method_get_end>` **(** :ref:`Variant<class_Variant>` name=0 **)** const |
  26. +-----------------------------+--------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`get_group_count<class_RegExMatch_method_get_group_count>` **(** **)** const |
  28. +-----------------------------+--------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_start<class_RegExMatch_method_get_start>` **(** :ref:`Variant<class_Variant>` name=0 **)** const |
  30. +-----------------------------+--------------------------------------------------------------------------------------------------------------+
  31. | :ref:`String<class_String>` | :ref:`get_string<class_RegExMatch_method_get_string>` **(** :ref:`Variant<class_Variant>` name=0 **)** const |
  32. +-----------------------------+--------------------------------------------------------------------------------------------------------------+
  33. Description
  34. -----------
  35. Contains the results of a single 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 sub-string for you.
  36. Property Descriptions
  37. ---------------------
  38. .. _class_RegExMatch_property_names:
  39. - :ref:`Dictionary<class_Dictionary>` **names**
  40. +----------+-------------+
  41. | *Getter* | get_names() |
  42. +----------+-------------+
  43. 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.
  44. ----
  45. .. _class_RegExMatch_property_strings:
  46. - :ref:`Array<class_Array>` **strings**
  47. +----------+---------------+
  48. | *Getter* | get_strings() |
  49. +----------+---------------+
  50. An :ref:`Array<class_Array>` of the match and its capturing groups.
  51. ----
  52. .. _class_RegExMatch_property_subject:
  53. - :ref:`String<class_String>` **subject**
  54. +----------+---------------+
  55. | *Getter* | get_subject() |
  56. +----------+---------------+
  57. The source string used with the search pattern to find this matching result.
  58. Method Descriptions
  59. -------------------
  60. .. _class_RegExMatch_method_get_end:
  61. - :ref:`int<class_int>` **get_end** **(** :ref:`Variant<class_Variant>` name=0 **)** const
  62. 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.
  63. Returns -1 if the group did not match or doesn't exist.
  64. ----
  65. .. _class_RegExMatch_method_get_group_count:
  66. - :ref:`int<class_int>` **get_group_count** **(** **)** const
  67. Returns the number of capturing groups.
  68. ----
  69. .. _class_RegExMatch_method_get_start:
  70. - :ref:`int<class_int>` **get_start** **(** :ref:`Variant<class_Variant>` name=0 **)** const
  71. 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.
  72. Returns -1 if the group did not match or doesn't exist.
  73. ----
  74. .. _class_RegExMatch_method_get_string:
  75. - :ref:`String<class_String>` **get_string** **(** :ref:`Variant<class_Variant>` name=0 **)** const
  76. 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.
  77. Returns an empty string if the group did not match or doesn't exist.