summaryrefslogtreecommitdiffstats
path: root/modules/regex/doc_classes
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-08-28 13:00:33 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-09-11 18:34:33 +0300
commit2964c7d51cbdaa616841c23d03f4a2f9966554b5 (patch)
treecaebc7905492a6d407de5391226c615d4dba543c /modules/regex/doc_classes
parent221884e6bc260c38f16422081b7d4efd49a71375 (diff)
downloadredot-engine-2964c7d51cbdaa616841c23d03f4a2f9966554b5.tar.gz
GDScript: Add raw string literals (r-strings)
Diffstat (limited to 'modules/regex/doc_classes')
-rw-r--r--modules/regex/doc_classes/RegEx.xml2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/regex/doc_classes/RegEx.xml b/modules/regex/doc_classes/RegEx.xml
index 5770e7155e..ab74fce3a9 100644
--- a/modules/regex/doc_classes/RegEx.xml
+++ b/modules/regex/doc_classes/RegEx.xml
@@ -10,7 +10,7 @@
var regex = RegEx.new()
regex.compile("\\w-(\\d+)")
[/codeblock]
- The search pattern must be escaped first for GDScript before it is escaped for the expression. For example, [code]compile("\\d+")[/code] would be read by RegEx as [code]\d+[/code]. Similarly, [code]compile("\"(?:\\\\.|[^\"])*\"")[/code] would be read as [code]"(?:\\.|[^"])*"[/code].
+ The search pattern must be escaped first for GDScript before it is escaped for the expression. For example, [code]compile("\\d+")[/code] would be read by RegEx as [code]\d+[/code]. Similarly, [code]compile("\"(?:\\\\.|[^\"])*\"")[/code] would be read as [code]"(?:\\.|[^"])*"[/code]. In GDScript, you can also use raw string literals (r-strings). For example, [code]compile(r'"(?:\\.|[^"])*"')[/code] would be read the same.
Using [method search], you can find the pattern within the given text. If a pattern is found, [RegExMatch] is returned and you can retrieve details of the results using methods such as [method RegExMatch.get_string] and [method RegExMatch.get_start].
[codeblock]
var regex = RegEx.new()