Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
RegExMatch
继承: RefCounted < Object
包含 RegEx 搜索的结果。
描述
包含由 RegEx.search() 和 RegEx.search_all() 返回的单个 RegEx 匹配结果。它可以用来查找匹配的位置和范围以及它的捕获组,并且可以提取其子字符串。
属性
|
||
|
||
|
方法
get_group_count() const |
|
get_string(name: Variant = 0) const |
属性说明
Dictionary names = {}
🔗
Dictionary get_names()
命名组的字典和它相应的组号。只有被匹配的组才被包括在内。如果多个组有相同的名称,该名称将指第一个匹配的组。
PackedStringArray strings = PackedStringArray()
🔗
PackedStringArray get_strings()
匹配项及其捕获组的 Array。
Note: The returned array is copied and any changes to it will not update the original property value. See PackedStringArray for more details.
String get_subject()
与搜索模式一起使用的源字符串,以找到这个匹配结果。
方法说明
int get_end(name: Variant = 0) const 🔗
返回源字符串中匹配的结束位置。捕获组的结束位置可以通过提供其组号的整数或其字符串名称(如果它是一个命名组)来检索。默认值为 0,指的是整个表达式。
如果该组没有匹配或不存在,则返回 -1。
返回捕获组的数量。
int get_start(name: Variant = 0) const 🔗
返回源字符串中匹配的起始位置。捕获组的起始位置可以通过提供它的组号作为一个整数或它的字符串名称(如果它是一个命名组)来检索。默认值为 0,指的是整个表达式。
如果组没有匹配或不存在,返回 -1。
String get_string(name: Variant = 0) const 🔗
返回源字符串中匹配的子串。捕获组可以通过提供它的组号作为整数或它的字符串名称(如果它是一个命名组)来检索。默认值为 0,指的是整个表达式。
如果组没有匹配或不存在,则返回一个空字符串。