I need a regular expression that allows me to validate the domain of the company in the input:
Let me explain: the people who are going to make a record in the form cannot enter a different email from the company
I need a regular expression that allows me to validate the domain of the company in the input:
Let me explain: the people who are going to make a record in the form cannot enter a different email from the company
I assume that the domain has a pattern to assign the email addresses, for example:
For the previous case, the way to validate it in Javascript is with the following regular expression:
If instead the email format is of type:
The regular expression would be:
In both cases it is very important to escape the periods and use the ^ at the beginning and the dollar sign ($) at the end, so that it matches the entire expression exactly.
And then you have to apply a method either to the string to validate or to the regular expression to see if there is a match.