From 3b2899bc42e442b9b4eb3b338d055a371c3383fe Mon Sep 17 00:00:00 2001 From: Ovnuniarchos Date: Tue, 3 Nov 2015 04:39:42 +0100 Subject: [PATCH] Regex class documented. For some reason, parameter descriptors don\'t appear. --- doc/base/classes.xml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index bd6ed64fdf2..e8e5ac00075 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -26656,7 +26656,7 @@ Reference frame for GUI. - Reference frame for GUI. It's just like an empty control, except a red box is displayed while editing around it's size at all times. + Reference frame for GUI. It's just like an empty control, except a red box is displayed while editing around its size at all times. @@ -26669,58 +26669,88 @@ + Simple regular expression matcher. + Class for finding text patterns in a string using regular expressions. Regular expressions are a way to define patterns of text to be searched. + This class only finds patterns in a string. It can not perform replacements. + Usage of regular expressions is too long to be explained here, but Internet is full of tutorials and detailed explanations. + Currently supported features: + Capturing [code]()[/code] and non-capturing [code](?:)[/code] groups + Any character [code].[/code] + Shorthand caracter classes [code]\w \W \s \S \d \D[/code] + User-defined character classes such as [code][A-Za-z][/code] + Simple quantifiers [code]?[/code], [code]*[/code] and [code]+[/code] + Range quantifiers [code]{x,y}[/code] + Lazy (non-greedy) quantifiers [code]*?[/code] + Begining [code]^[/code] and end [code]$[/code] anchors + Alternation [code]|[/code] + Backreferences [code]\1[/code] to [code]\99[/code] + [OK] if the regular expression was valid. [FAIL] otherwise. + The string to be converted into a regular expression. + Once created, a RegEx object needs a regular expression to be assigned to it. This method tries to convert the string given to an usable regular expression. + The position within the string (starting with 0) where the pattern was found. It will return -1 if the pattern was not found, it was invalid, or the start or end positions were beyond the string's end. + The text to search the pattern in. + The position in the string (starting with 0) to start searching from. + The position in the string (starting with 0) to stop searching. A value less than the start position means "end of the string". + This method tries to find the pattern within the string, and returns the position where it was found. It also stores any capturing group (see [method get_capture]) for further retrieval. + This method resets the state of the object, as it was freshly created. Namely, it unassigns the regular expression of this object, and forgets all captures made by the last [method find]. + Returns whether this object has a valid regular expression assigned. + Returns the number of capturing groups. A captured group is the part of a string that matches a part of the pattern delimited by parentheses (unless they are non-capturing parentheses [i](?:)[/i]). + The number of the captured group, starting with 0. Like other regular expression engines, Godot's engine takes 0 as the full expression, and 1 as the first pair of capturing parentheses. + Returns a captured group. A captured group is the part of a string that matches a part of the pattern delimited by parentheses (unless they are non-capturing parentheses [i](?:)[/i]). + A list contining all the strings captured by the regular expression. + Return a list of all the captures made by the regular expression.