summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorpunto- <ariel@okamstudio.com>2015-07-24 13:17:58 -0300
committerpunto- <ariel@okamstudio.com>2015-07-24 13:17:58 -0300
commit257dba9a4a545a3e2ff7da3dab348899245fd998 (patch)
tree597b33bf8964c4d13089a35d3ed108b7895e1ead /demos
parentf697ec2fe022583dde5f3ae650f49cfd7f237c33 (diff)
parent69eff35cd5758aa4a6d299989342ae0e08894a8f (diff)
Merge pull request #2300 from leezh/nrex-port
New RegEx library
Diffstat (limited to 'demos')
-rw-r--r--demos/misc/regex/engine.cfg4
-rw-r--r--demos/misc/regex/regex.gd22
-rw-r--r--demos/misc/regex/regex.scnbin0 -> 1772 bytes
3 files changed, 26 insertions, 0 deletions
diff --git a/demos/misc/regex/engine.cfg b/demos/misc/regex/engine.cfg
new file mode 100644
index 0000000000..0a6f4f869c
--- /dev/null
+++ b/demos/misc/regex/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="RegEx"
+main_scene="res://regex.scn"
diff --git a/demos/misc/regex/regex.gd b/demos/misc/regex/regex.gd
new file mode 100644
index 0000000000..e648c18093
--- /dev/null
+++ b/demos/misc/regex/regex.gd
@@ -0,0 +1,22 @@
+extends VBoxContainer
+
+var regex = RegEx.new()
+
+func update_expression():
+ regex.compile(get_node("Expression").get_text())
+ update_text()
+
+func update_text():
+ var text = get_node("Text").get_text()
+ regex.find(text)
+ var list = get_node("List")
+ for child in list.get_children():
+ child.queue_free()
+ for res in regex.get_captures():
+ var label = Label.new()
+ label.set_text(res)
+ list.add_child(label)
+
+func _ready():
+ get_node("Text").set_text("They asked me \"What's going on \\\"in the manor\\\"?\"")
+ update_expression()
diff --git a/demos/misc/regex/regex.scn b/demos/misc/regex/regex.scn
new file mode 100644
index 0000000000..2b62d6b82a
--- /dev/null
+++ b/demos/misc/regex/regex.scn
Binary files differ