class_regexmatch.rst 5.3 KB

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