Question

Part II: 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), 5),6), 11) e.g. (ab+a, (extended regex ) a) ababa b) aba c)abba d)aabba e)aa Answer: b,c; Pattern : The matched string should begin and end with a and ‘b occurs at least once between leading and ending ‘a) ote: 1) to 5)are basic regexes 1) a[ab]*a (a)ababa (b) aaba (c) aabab (d) aabbaa (e)aa 2) a(bc)? (a) abc (b) a(bc)? (c) a(bc (d) a (e) abcbc 3) ind] (a) wind (b) window (c) end(d) good (e)will (a) a+b+c (b) +b (d) x+1 (e) x+a ote: 5) to 12) are extended regexes (a) a+b+c(b) +b (d) x+1 (e) x+a (a)azbc (b) az(c) azbcbc (d) acc (e)acz 7) a.[0-9] (a)azz (b) a0z (c) a01 (d) a0a (e)aza (a)good! (b) Book. (c) hard? (d) cool?hot (e)nothing

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. a,b,d,e

  • The text that will start with 'a', followed by zero or more occurrences of a or b and then end by 'a'.
  • c does not follow the pattern match as it ends with b.

2. a,d

  • The text that will start with 'a' followed by zero or 1 occurrence of ab.
  • b,c and e are incorrect as they do not follow the pattern.

3. a,d

  • The text will have a single character except for the new line and then followed by 0 or more occurrences of I, n, and d.
  • b, c and e do not match the pattern as 'the window' has o and w that is not included in the pattern. 'good' also has more than one character that is not included in the pattern. Similarly, will also have more than 1 character not included in the pattern.

4. none of these

  • The text should have one or more characters of a followed by any single character from a to z. There does not include any + sign in between the text. Hence, the option a,b,d ,and e are incorrect.
  • Also, option c is incorrect as it should minimum have 2 characters.

5. a and e

  • The pattern should have a single character from a to z followed by one or more occurrences of characters from a to z and + as a symbol.
  • Option b is incorrect as it starts with + symbol and not with any character from a to z.
  • Option c is incorrect as there should be at least 2 characters.
  • Option d is incorrect 1 is included which is not a part of the regex.

6. a,c and d

  • The text should start from a and then followed by any character except newline and followed by one or more characters of b and c. Hence, it should start from a and end with the combination of b or c.
  • Option b is not correct as it ends with z. Option e is also incorrect as it ends with z.

Friend, this was a really nice question to answer. As per the Chegg policy, I am obliged to answer the first four questions. If you think my answer deserves like, please like it. Thanks.

Add a comment
Know the answer?
Add Answer to:
Part II: Regular Expression 1. Chose match(es) for each given basic/extended regular expression (maybe multiple correct...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Could I get these answered and explained to me? I'm new to system level programming and...

    Could I get these answered and explained to me? I'm new to system level programming and rather lost on how to answer or think through these. I'll definitely provide a thumbs up to those who can give an explanation along with their answer. Thanks a bunch! match(es) for expression (maybe each given basic/extended multiple Choose 1. regular no correct match, if no correct option is given then write none as your anser 3), matches or correct and describe the of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT