From 4ca0399ff6a16c7e5e760d57a7675df61f1f8ef0 Mon Sep 17 00:00:00 2001 From: Zher Huei Lee Date: Fri, 24 Jul 2015 13:55:18 +0100 Subject: [PATCH] Added a live-edit RegEx tester to the demos --- demos/misc/regex/engine.cfg | 4 ++++ demos/misc/regex/regex.gd | 22 ++++++++++++++++++++++ demos/misc/regex/regex.scn | Bin 0 -> 1770 bytes 3 files changed, 26 insertions(+) create mode 100644 demos/misc/regex/engine.cfg create mode 100644 demos/misc/regex/regex.gd create mode 100644 demos/misc/regex/regex.scn diff --git a/demos/misc/regex/engine.cfg b/demos/misc/regex/engine.cfg new file mode 100644 index 00000000000..0a6f4f869cf --- /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 00000000000..a2dc62bf83d --- /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.match(text) + var list = get_node("List") + for child in list.get_children(): + child.queue_free() + for res in regex.get_capture_list(): + 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 0000000000000000000000000000000000000000..591b60974aaf5724ac456f43abb3770d56da8b59 GIT binary patch literal 1770 zcmWkvYitzP6+W}G>wWmO#xMNb>jfJ-ky#)VOHPB&?5tUgfV#FJX-Swn-o3k?vOBY# z8Jo4S!kPdMA^d2Y(gH5oghEo35QU0DYXvq0^+yCv8d2IH)Q&4K3N4{1sgi;kI=#}> zy`OX*pU!vBxdVfu2>)Mxfc{c|Pl^CIfE))LDMB6rN{F+hUyf~K@xd5V8F1*gRsi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