Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help on part 2. I need help with all of part 2 questions. I will upvote if all of my questions about this assignment

Please help on part 2. I need help with all of part 2 questions. I will upvote if all of my questions about this assignment are answered. Thanks in advanced. image text in transcribed
image text in transcribed
image text in transcribed
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), 6), 11). e.g. ' ab+a ' (extended regex) a) ababa b) aba c)abba d)aabbaa 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 ') Note: 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) "[nd] ], (a) wind (b) window (c) end (d) good (e)will 4) ' [az]+[09] ' (a) a++ (b) aa a+ (c) 6+ (d) a+6 (e) aa+1 Note: 5) to 12) are extended regexes. 5) ' a(ab)a ' (a)ababa (b) aaba (c) aabab (d) aabbaa (e)aa 6) ' [az](1+[az09])+ ' (a) x+9 (b) x+y (c) 1 (d) y (e) x++y 7) ' a(bc)z ' (a)azbc (b) az (c) azbcbc (d) acc (e)acz 8) 'a. [09] ' (a)a|1 (b) a2 (c) ab2 (d) abc (e)aaa 9) "[at]+[L.1?++] (a)bash! (b) c (c) Java? (d) python! (e)c++ 110) '[a-Z] +[.12!]s[AZ] ' (hint: 's matches any whitespace characters) (a)o. year(b) x?y (c) U.S. (d)Hello!HELLO (e)index?a 11) '(veryls)?(coolls) +( good bad) weather' (a) very weather (b) very cool weather (c) good weather (d) very cool good weather (e)cool bad weather 12) '-?([0-9]|([1-9][0-9]))' (a) 123 (b) 123 (c) 0 (d) 2.2 (e) 1.2 13) )5?[09]\.?[09], (a) 123 (b) 123 (c) - 0 (d) 2.2 (e) 1.2 2. Write down the extended regular expression for following questions. E.g. Social security number in the format of 999-99-9999. Answer: [09]{3}[09]{2}[09]{4} 1) 1) Valid date format in the format of MMM-DD,YYYY. Note; the first character of the month is capitalized. (e.g. May-09,2008 Apr-19,2018 Jan-01,2000) 2) An account name which is 8 to 15 characters long, begins with a letter or underscore, ends with a digit, and composed by letters, numbers, underscores and hyphens. (e.g. my_Namel, cat_2, One-1) 3) A single-line comment starting with a \# and continuing until the end of the line. Note: only whitespace is allowed between the start of the line and the comment. (e.g. \#This program outputs the string hello world. ) 4) Integers in the range between 00 and 99. (e.g. 0,00,01,15,55,59,99 ) 5) Phone number in any of the following format: 999-(999)9999, 9999999999, 999-999-9999. (Note: all of these formats should be matched by a single regular expression)

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

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions

Question

Choose an appropriate organizational pattern for your speech

Answered: 1 week ago

Question

Writing a Strong Conclusion

Answered: 1 week ago