Question: Regular Expressions a) Create a regular expression in Python to match the following expressions: [aabc, aaabc,bc, ac]. b) Write an expression in Python to extract

Regular Expressions

a) Create a regular expression in Python to match the following expressions: [aabc, aaabc,bc, ac]. b) Write an expression in Python to extract all email addresses appearing in a line in the following format: firstname.lastname@somecompany.com Here firstname and lastname may contain letters and numbers but no other characters (e.g., John13.Smith or 3Ann.Muller but not Ann!Brown). somecompany may contain only letters and no other characters (e.g., UniBE or NetCo but not Big5 or Smart_City). c) Write an expression in Python to extract all phone numbers appearing in a line in the following formats: (078) 567 55 41 or 078 5675541. Spaces could occur between any digits and the first three digits (without spaces) could be indicated between parenthesis or not.

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!