Merge pull request #2642 from leezh/nrex-update

Updated nrex with new features
This commit is contained in:
Juan Linietsky
2015-11-18 19:13:57 -03:00
7 changed files with 696 additions and 201 deletions

View File

@ -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())

Binary file not shown.