I’d like to know a regex that would validate:
an email address to this form: 234903284@student.uws.edu.au
couple issues:
“student.” is optional and could be any word eg “teacher.”.
“324234234” can be any alpha numeric characters (number, word, _ etc.)
the email must end in “uws.edu.au”
This is what I have so far:
/(\d*)@\w*\.uws\.edu\.au/
valid addresses:
me@uws.edu.au
234234324@student.uws.edu.au
theking@teacher.uws.edu.au
etc.
Thanks Guys
You said:
Your regex will match
"@teacher.uws.edu.au"(i.e. “name portion” omitted).To fix this, you could use:
Which will require at least one character in the name portion, and at least one char before the dot (if there is a dot) in the subdomain spot.
Also (I think) that
\wwill not match.(and probably other chars that you care about in the name portion too), sobob.jones@student.uws.edu.auwould fail to match. The following would add the char.,_, and-into the “name” portion:you could add any other chars you need in the same way.
NOTE: Matching email addresses in general a more complex thing than you might think (lots of strange things are technically allowed in email addresses. Here is an article on the subject (There are many other sources of similar information available).