Improve regex demo

This commit is contained in:
Aaron Franke
2020-02-02 03:48:51 -05:00
parent 67a490ab50
commit abf9d68bf4
2 changed files with 7 additions and 6 deletions

View File

@@ -1,12 +1,17 @@
extends VBoxContainer
# Member variables
var regex = RegEx.new()
func _ready():
$Text.set_text("They asked me \"What's going on \\\"in the manor\\\"?\"")
update_expression($Expression.text)
func update_expression(text):
regex.compile(text)
update_text()
func update_text():
for child in $List.get_children():
child.queue_free()
@@ -17,7 +22,3 @@ func update_text():
var label = Label.new()
label.text = result
$List.add_child(label)
func _ready():
$Text.set_text("They asked me \"What's going on \\\"in the manor\\\"?\"")
update_expression($Expression.text)

View File

@@ -2,7 +2,7 @@
[ext_resource path="res://regex.gd" type="Script" id=1]
[node name="VBoxContainer" type="VBoxContainer"]
[node name="Regex" type="VBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 14.0