I am using the following RegEx with pattern() to validate an input
pattern('^[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$')
This should validate inputs like "example.yes" or even "a.b" and invalidate inputs like "pie". However, this seems to validate any character input that is longer than 2 characters without a "." in it.
What is the built-in email format validation you are referring to?
Is it different from type="email" attr for HTML input tag?
Main reason is that I want to validate a basic domain input (not just email) and I also have other validations that I am checking on top of that, which I want to display in a consistent way that I can style myself.
I tried this - thanks for the suggestion, but I want to:
Validate a basic domain input (not email)
Want to display different validation error messages checked by other regex patterns that look consistent
I want to validate inputs before submission (not on submit)
I understand this complicates things but just wondering if there is something inherently wrong or defective with my regex I showed above if that is how I want to do the validation (or if i want to expand this first regex for a more custom validation)?