Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | PerduGames | |
Old Version | Published before Godot 3 was released. |
I’m trying to validate emails, but I can not understand very well how regular exepression works in godot, I’m getting an error in the “.compile” lines, am I forgetting to escape some character?
func validate_email(email):
var exclude = RegEx.new()
var check = RegEx.new()
var checkend = RegEx.new()
exclude.compile("[^@-.w]|^[_@.-]|[._-]{2}|[@.]{2}|(@)[^@]*1")
check.compile("@[w-]+.")
checkend.compile(".[a-zA-Z]{2,3}$")
if exclude.search(email) != null || check.search(email) != null || checkend.search(email) != null:
return false
else:
return true