Question: I need help with this python program on regular expressions ASAP. Thank you !! Problem 2: Groups Consider a regular expression that identifies street addresses,

I need help with this python program on regular expressions ASAP. Thank you !!

I need help with this python program on regular expressions ASAP. Thankyou !! Problem 2: Groups Consider a regular expression that identifies streetaddresses, with the format: 1. One or more digits, followed by a

Problem 2: Groups Consider a regular expression that identifies street addresses, with the format: 1. One or more digits, followed by a space. 2. One or more words, each starting with a capital letter and then followed by zero or more lowercase letters. This will be followed by a space. 3. A road type, one of "Rd.", "Dr.", "Ave." or "St." So the following are valid street names: 465 Northwestern Ave. 201 South First St. 22 What A Wonderful Ave. 123 Mayb3 You 222 Did not think 333 This Through Rd. Assume that we will only test with valid street names. There will only be 'one valid street name' in a test case. However, there may be other words preceeding or following the valid street name. Please note the last test case and strictly adhere to the specifications in the address format mentioned above. Fill in the function problem2 . This function should search an input string for any valid street address, then return just the street name from that address: not the street number, and not the road type. So if you pass in: The EE building is at 465 Northwestern Ave. you should return: Northwestern If you pass in: Meet me at 201 South First St. at noon you should return: South First Also, if you pass in: 123 Mayb3 You 222 Did not think 333 This Through Rd. Did You Ave. you should return: This Through . (Note: Existence of any character which interferes with any upper case letter being followed by zero or more lowercase letters, after one or more digits invalidates the address name. This should indicate that you begin looking in the rest of the input) def problem2 (searchstring): Extract street name from address. :param searchstring: string :return: string pass

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!