Question: You must start the regular expression with a ^ and end with a $ to generate the behavior we desire, and wrap it in ().
You must start the regular expression with a ^ and end with a $ to generate the behavior we desire, and wrap it in (). So in other words ^(stuff goes here)$
MAKE SURE to USE FLAVOR PCRE2 (PHP >= 7.3) for REGEX 101.
Use the website (regex101.com). Note that you can only use (), | (for the books +), and the Kleene Star *. Also assume the alphabet {a b}
Copy and paste the following tests.
Make sure to just submit a plain text copy of the regular expression.
Assume common sense applies (e.g. do not simply write a regular expression that ORs together all the tests).
5. ODD-ODD, all strings that have an odd number of as and an odd number of bs
These strings should have FULL matching
ab
aaab
aaaaab
aaaaaaab
baaa
baaaaa
ba
bbba
bbbbba
bbbbbbba
abaa
ababab
aaaaabbb
These strings should NOT have FULL matching:
a
aa
aaa
b
bbb
bb
abba
aabb
aaabb
ababa
babbbba
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
