Answered step by step
Verified Expert Solution
Question
1 Approved Answer
even / odd / substring: x in { a , b } x has an even number of a s , or x has an
evenoddsubstring:
x in a b x has an even number of as or x has an odd number of bs or
x contains both the substrings babb and aabaa
first appears more:
x in x and the first symbol of x appears at least three times total in x
repeat near end: x in xx xx
Assume we start indexing at so that xx is the last symbol in x and x is the first.
email: x in Sigma x is a syntactically valid email address
Definition of syntactically valid email address: Let Sigma @ a b contain the
alphabetic symbols a and b as well as the symbols for period and at @ Syntactically
valid emails are of the form username@host.domain where username and host are nonempty
and may contain alphabetic symbols or but never two s in a row, nor can either of them
begin or end with a and domain must be of length or and contain only alphabetic
symbols. For example, aaba@aaabb.aba and abba@ababb.ba are valid email addresses,
but aaabb.aba is not no @ symbol nor is ba@ababb.ba username starts with a nor is
Its not that hard to make a regex that actually uses the full alphanumeric alphabet here, but historically weve
found that many students solutions are correct but use so many subexpressions that they crash the simulator. Using
only two alphabetic symbols a and b reduces this problem, even though it makes the examples more artificiallooking.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started