Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

need help writing a regular expression for { x {a, b, ., @} | x is a syntactical

ID: 3595807 • Letter: N

Question

need help writing a regular expression for { x {a, b, ., @} | x is a syntactically valid email address } where Definition of “syntactically valid email address”: We assume email addresses contain only the characters a and b (no digits and none of the other Roman alphabet symbols), in addition to the @ and . symbols. Emails are of the form username@host.domain where username and host are nonempty and may contain a, b, or ., but never two .’s in a row, nor can either of them begin or end with a .), and domain must be of length 2 or 3 and contain only a and b. For example, aaa.bba.bbb@ababab.bbab.aaa and ababa@baba.ab are valid email addresses, but ab.ab is not (no @ symbol), nor is .ab@ab.ab (username starts with a .), nor is ab@ab.abab (domain is too long).

Explanation / Answer

(a|b)(a|b)*(.(a|b))*(a|b)*@(a|b)(a|b)*(.(a|b))*(a|b)*.((a|b)(a|b)(a|b)?)

here this will work as its following all rules mentioned.