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

Part Il: Regular Expression 1. Chose match(es) for each given basic/extended reg

ID: 3747912 • Letter: P

Question

Part Il: Regular Expression 1. Chose match(es) for each given basic/extended regular expression (maybe multiple correct matches) and describe the pattern of matched string for 3),4) 6).11). eg. abta (extended regex Answer: bc ; Pattern : The matched string should begin and end with and b'occurs at least once between leading and ending 1) a(ab)a 2) a?lbc 3) Ind (a)ababa (b) aaba (c) aabab (d) aabbaa (eaa (a) abc (b)abc)bd) a?(e) abcbc (a) wind (b) window (c) end (d) good (e)will (b))6(d) a+6 e-1 5) a(alb)'a (a)ababa (b)aaba (c) aabab (d) aabbaa (eaa (a) x+9 (b)xy (c)1 1(d)y (e)xy 7) 'a (bc)' (b) az(c) azbcbc (d) acc (eaca 8) a [0.9] (a)al1 (b)a*2 ()b (d) abc (eaa (a)bash! (b)c (c) Java? (d) python (e)cs 10) "la-z)+M?!s"[A-Z), (hint: Vs matches any whitespace characters) (a)o. year(b)xy ()S (d)Hello HELLO (e)indexta 11) vey s)?(coolls) (goodlbad) weather (b) very cool weather (a)very weather (c) good weather (d) very cool good weather (e)col bad weather 12) 7(1O-9)101-9110-9)) (b)-123 ()0(d)-22 12 13) 0-9710-9] (b)-123 (c)0(d)-22 e1.2

Explanation / Answer

3) will

as it was mentioned that -[ad]* means the answer should not consists any of the letters mwntioned in the regular expression.

4) a+6

[a-z] + [0-9] means any letter from a to z followed by the digits 0 to 9, just one of it

6) x+y

[a-z](+[a-z0-9])+ means it starts with any alphabet from a to z and follwed by + and followed by any lowercase letter, any digit. we can consider alphabet at the second position because as the regular expression starts with alphabet (x+9 is also correct as well)

11) very cool good weather

(verys)?(cools)+(good|bad) weather means very(? indicates braces are optional) followed by cool followe by good|bad followed by weather.