diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-11-18 19:13:57 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-11-18 19:13:57 -0300 |
commit | 474822b6db6c96aba2684aac7039ee03b605630c (patch) | |
tree | 5e20a94cbb60cf3288d30077a014ba4a1a60643c /demos/misc | |
parent | 6aa95e77f3bae35fb136eb00e271362c1707058e (diff) | |
parent | f0d246a7bce9f8f22e9886d474f1758e0c20d8cb (diff) |
Merge pull request #2642 from leezh/nrex-update
Updated nrex with new features
Diffstat (limited to 'demos/misc')
-rw-r--r-- | demos/misc/regex/regex.gd | 18 | ||||
-rw-r--r-- | demos/misc/regex/regex.scn | bin | 1772 -> 1793 bytes |
2 files changed, 10 insertions, 8 deletions
diff --git a/demos/misc/regex/regex.gd b/demos/misc/regex/regex.gd index e648c18093..409b4cab05 100644 --- a/demos/misc/regex/regex.gd +++ b/demos/misc/regex/regex.gd @@ -2,21 +2,23 @@ extends VBoxContainer var regex = RegEx.new() -func update_expression(): - regex.compile(get_node("Expression").get_text()) +func update_expression(text): + regex.compile(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) + if regex.is_valid(): + regex.find(text) + 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() + update_expression(get_node("Expression").get_text()) + diff --git a/demos/misc/regex/regex.scn b/demos/misc/regex/regex.scn Binary files differindex 2b62d6b82a..1f46521d0d 100644 --- a/demos/misc/regex/regex.scn +++ b/demos/misc/regex/regex.scn |