summaryrefslogtreecommitdiff
path: root/modules/regex/doc_classes/RegExMatch.xml
blob: 245201006d340ef6d2a042819cef47d84ae202d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RegExMatch" inherits="Reference" category="Core" version="3.2">
	<brief_description>
		Contains the results of a regex search.
	</brief_description>
	<description>
		Contains the results of a single regex match returned by [method RegEx.search] and [method RegEx.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.
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="get_end" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="name" type="Variant" default="0">
			</argument>
			<description>
				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.
				Returns -1 if the group did not match or doesn't exist.
			</description>
		</method>
		<method name="get_group_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Returns the number of capturing groups.
			</description>
		</method>
		<method name="get_start" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="name" type="Variant" default="0">
			</argument>
			<description>
				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.
				Returns -1 if the group did not match or doesn't exist.
			</description>
		</method>
		<method name="get_string" qualifiers="const">
			<return type="String">
			</return>
			<argument index="0" name="name" type="Variant" default="0">
			</argument>
			<description>
				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.
				Returns an empty string if the group did not match or doesn't exist.
			</description>
		</method>
	</methods>
	<members>
		<member name="names" type="Dictionary" setter="" getter="get_names">
			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.
		</member>
		<member name="strings" type="Array" setter="" getter="get_strings">
			An [Array] of the match and its capturing groups.
		</member>
		<member name="subject" type="String" setter="" getter="get_subject">
			The source string used with the search pattern to find this matching result.
		</member>
	</members>
	<constants>
	</constants>
</class>