I am having a problem validating domains. What am I doing wrong?
Regex re = new Regex("^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\\.[a-zA-Z]{2,}$");
if (re.IsMatch(domain.Text))
// if (Regex.IsMatch(domain.Text, @"^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\\.[a-zA-Z]{2,}$"))
warningLabel.Text = "Domain format is invalid!"; // domain: " + domain.Text;
I checked with Regex checker and got "your pattern matches but there were no (capturing (groups)) in it that matched anything in the subject string."
Why I don't get errors on invalid characters?
Thank you.