[DOCS] Adds RegExMatch doc and RegEx fix typo
This commit is contained in:
parent
f4ddbc024c
commit
5c6172c5cf
|
@ -5,7 +5,7 @@
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
Class for finding text patterns in a string using regular expressions. It can not perform replacements. Regular expressions are a way to define patterns of text to be searched. Details on writing patterns are too long to explain here but the Internet is full of tutorials and detailed explanations.
|
Class for finding text patterns in a string using regular expressions. It can not perform replacements. Regular expressions are a way to define patterns of text to be searched. Details on writing patterns are too long to explain here but the Internet is full of tutorials and detailed explanations.
|
||||||
Once created, the RegEx object needs to be compiled with the pattern before it can be used. The pattern must be escaped first for gdscript before it is escaped for the expression. For example:
|
Once created, the RegEx object needs to be compiled with the search pattern before it can be used. The search pattern must be escaped first for gdscript before it is escaped for the expression. For example:
|
||||||
[code]var exp = RegEx.new()[/code]
|
[code]var exp = RegEx.new()[/code]
|
||||||
[code]exp.compile("\\d+")[/code]
|
[code]exp.compile("\\d+")[/code]
|
||||||
would be read by RegEx as [code]\d+[/code]
|
would be read by RegEx as [code]\d+[/code]
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
<argument index="0" name="pattern" type="String">
|
<argument index="0" name="pattern" type="String">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Compiles and assign the regular expression pattern to use.
|
Compiles and assign the search pattern to use.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_group_count" qualifiers="const">
|
<method name="get_group_count" qualifiers="const">
|
||||||
|
@ -68,14 +68,14 @@
|
||||||
<return type="String">
|
<return type="String">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Returns the expression used to compile the code.
|
Returns the search pattern used to compile the code.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="is_valid" qualifiers="const">
|
<method name="is_valid" qualifiers="const">
|
||||||
<return type="bool">
|
<return type="bool">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Returns whether this object has a valid regular expression assigned.
|
Returns whether this object has a valid search pattern assigned.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="search" qualifiers="const">
|
<method name="search" qualifiers="const">
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
<argument index="2" name="end" type="int" default="-1">
|
<argument index="2" name="end" type="int" default="-1">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Searches the text for the compiled pattern. Returns a [RegExMatch] container of the first matching reult if found, otherwise null. The region to search within can be specified without modifying where the start and end anchor would be.
|
Searches the text for the compiled pattern. Returns a [RegExMatch] container of the first matching result if found, otherwise null. The region to search within can be specified without modifying where the start and end anchor would be.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="sub" qualifiers="const">
|
<method name="sub" qualifiers="const">
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<class name="RegExMatch" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
|
<class name="RegExMatch" inherits="Reference" category="Core" version="3.0.alpha.custom_build">
|
||||||
<brief_description>
|
<brief_description>
|
||||||
|
Contains the results of a regex search.
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
|
Contains the results of a regex search. [method RegEx.search] returns an instance of [code]RegExMatch[/code] if it finds the search pattern in the [source] string.
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
@ -15,7 +17,7 @@
|
||||||
<argument index="0" name="name" type="Variant" default="0">
|
<argument index="0" name="name" type="Variant" default="0">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns the end position of the match in the string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
|
Returns the end position of the match in the [source] string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_group_count" qualifiers="const">
|
<method name="get_group_count" qualifiers="const">
|
||||||
|
@ -38,7 +40,7 @@
|
||||||
<argument index="0" name="name" type="Variant" default="0">
|
<argument index="0" name="name" type="Variant" default="0">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns the starting position of the match in the string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
|
Returns the starting position of the match in the [source] string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_string" qualifiers="const">
|
<method name="get_string" qualifiers="const">
|
||||||
|
@ -47,19 +49,21 @@
|
||||||
<argument index="0" name="name" type="Variant" default="0">
|
<argument index="0" name="name" type="Variant" default="0">
|
||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns the result of the match in the string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
|
Returns the result of the match in the [source] string. An integer can be specified for numeric groups or a string for named groups. Returns -1 if that group wasn't found or doesn't exist. Defaults to 0 (whole pattern).
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_strings" qualifiers="const">
|
<method name="get_strings" qualifiers="const">
|
||||||
<return type="Array">
|
<return type="Array">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
|
Returns an [Array] of the matches in the [source] string.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_subject" qualifiers="const">
|
<method name="get_subject" qualifiers="const">
|
||||||
<return type="String">
|
<return type="String">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
|
Returns the [source] string used with the search pattern to find this matching result.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
|
|
Loading…
Reference in New Issue