0 votes

I would like for an @ symbol to be entered by the user in a textedit, however am unsure of how to code for a verification system on what is entered.

in Engine by (60 points)

1 Answer

+1 vote
Best answer


Are you looking to verify it's an email address?

You can use regex as a simple test, based on this Stack Overflow page

Or if you want to check the @ symbol is in the text, you can use in

Both like this:

extends Node2D

var email1 = "[email protected]"
var email2 = "me.here.com"
var email3 = "[email protected]"

func _ready() -> void:
    var regex = RegEx.new()
    regex.compile("^[a-zA-Z0-9_.+-][email protected][a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$")

    print("@" in email1)
    print("@" in email2)
    print("@" in email3)

So the output of the above would be:


Only 1 valid email address, but 2 contain an @ symbol.

Hopefully, that's what you mean :)

by (1,967 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.