mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 06:09:46 +03:00
Improve regex demo
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user