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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started