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.

RegExMatch

繼承: RefCounted < Object

包含 RegEx 搜索的結果。

說明

包含由 RegEx.search()RegEx.search_all() 返回的單個 RegEx 配對結果。它可以用來搜尋配對的位置和範圍以及它的捕獲組,並且可以提取其子字元串。

屬性

Dictionary

names

{}

PackedStringArray

strings

PackedStringArray()

String

subject

""

方法

int

get_end(name: Variant = 0) const

int

get_group_count() const

int

get_start(name: Variant = 0) const

String

get_string(name: Variant = 0) const


屬性說明

Dictionary names = {} 🔗

命名組的字典和它相應的組號。只有被配對的組才被包括在內。如果多個組有相同的名稱,該名稱將指第一個配對的組。


PackedStringArray strings = PackedStringArray() 🔗

配對項及其捕獲組的 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 subject = "" 🔗

與搜索模式一起使用的源字串,以找到這個配對結果。


方法說明

int get_end(name: Variant = 0) const 🔗

返回源字串中配對的結束位置。捕獲組的結束位置可以通過提供其組號的整數或其字符串名稱(如果它是一個命名組)來檢索。預設值為 0,指的是整個運算式。

如果該組沒有配對或不存在,則返回 -1。


int get_group_count() const 🔗

返回捕獲組的數量。


int get_start(name: Variant = 0) const 🔗

返回源字串中配對的起始位置。捕獲組的起始位置可以通過提供它的組號作為一個整數或它的字串名稱(如果它是一個命名組)來檢索。預設值為 0,指的是整個表達式。

如果組沒有配對或不存在,返回 -1。


String get_string(name: Variant = 0) const 🔗

返回源字串中配對的子串。捕獲組可以通過提供它的組號作為整數或它的字串名稱(如果它是一個命名組)來檢索。預設值為 0,指的是整個運算式。

如果組沒有配對或不存在,則返回一個空字串。