2015-12-09 07:38:23 +00:00
|
|
|
|
2015-07-24 12:55:18 +00:00
|
|
|
extends VBoxContainer
|
|
|
|
|
2015-11-21 12:31:25 +00:00
|
|
|
# Member variables
|
2015-07-24 12:55:18 +00:00
|
|
|
var regex = RegEx.new()
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
|
2015-10-20 08:51:00 +00:00
|
|
|
func update_expression(text):
|
|
|
|
regex.compile(text)
|
2015-07-24 12:55:18 +00:00
|
|
|
update_text()
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
|
2015-07-24 12:55:18 +00:00
|
|
|
func update_text():
|
|
|
|
var text = get_node("Text").get_text()
|
|
|
|
var list = get_node("List")
|
|
|
|
for child in list.get_children():
|
|
|
|
child.queue_free()
|
2015-10-20 08:51:00 +00:00
|
|
|
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)
|
2015-07-24 12:55:18 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
|
2015-07-24 12:55:18 +00:00
|
|
|
func _ready():
|
|
|
|
get_node("Text").set_text("They asked me \"What's going on \\\"in the manor\\\"?\"")
|
2015-10-20 08:51:00 +00:00
|
|
|
update_expression(get_node("Expression").get_text())
|