Page 1 of 1

1. Write a regular expression for each of the following questions that matches numbers of the binary system. Use only th

Posted: Fri Apr 29, 2022 7:00 am
by answerhappygod
1. Write a regular expression for each of the following
questions that matches numbers of the binary system. Use only
the basic operators.
(a) any number other than 11 or 111
(b) any number where the digits in even positions are 1
c) any number with at least two 1s and at most one 0
d) any number ending in 00
e) any number that does not have 2 consecutive 1
2. Write a regular expression for each of the following
sets of binary strings. Use only the basic operators.
a) has at least 3 characters and the third character is 0
b) the number 0 is a multiple of 3
c) begins and ends with the same character
d) has unnecessary length
e) starts with 0 and has an unnecessary length or starts with 1 and
has an even length
f) the length is at least 1 and at most 3
(g) any number beginning with 1 and ending with
1
3. Write a regular expression to check if a password is secure.
That is, it should contain:
a) at least 3 lowercase
b) at least 3 chapters
c) at least 2 numbers
d) at least one of them! @ # $ and *
e) does not contain the same character 2 times in a row (eg "steel"
is not valid)