1👍
✅
The [nith.ac.in]
does not parse literal text, it parses any character in te group, meaning it can end with a sequence of n
s, i
s, ni
s, etc.
Your regex should look like:
email = models.EmailField(
unique=True,
validators=[
RegexValidator(
regex=r'^[2][2][a-zA-Z]{3}\d{3}@nith[.]ac[.]in$',
message='Only freshers with college email addresses are authorised.',
)
],
)
Source:stackexchange.com