Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

even / odd / substring: x in { a , b } x has an even number of a s , or x has an

even/odd/substring:
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 {0,1}||x|>=3 and the first symbol of x appears at least three times total in x}
repeat near end: {x in {0,1}| x[|x|5]= x[|x|3]}
Assume we start indexing at 1, so that x[|x|] is the last symbol in x, and x[1] 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,1 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 2 or 3 and contain only alphabetic
symbols. For example, aaba@aaabb.aba and ab.ba@ab.abb.ba are valid email addresses,
but aaabb.aba is not (no @ symbol), nor is .ba@ab.abb.ba (username starts with a .), nor is
1Its 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 artificial-looking.
2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions