Use regular expression to implement a function which accepts a passed string and check if it is a valid email address. A program accepts user's input and calls the email validation function. If the email is valid, print out the email, username and host. (Rule: word characters (a-zA-Z0-9_ or "w"), dot, and hyphen are considered as valid characters in an email address, besides of one & only one '@'.) (Sample output as shown in the following figure is for demonstration purposes only.) In [24]: runfile('C:/tmp/units/2020/SIT384-2020-1/portfolio/week2/ Task2.3P.py', wdir='C:/tmp/units/2020/SIT384-2020-1/portfolio/week2') Please input your email address:test@ Not a valid email. Please input your email address: shang.gao@test2.server.com email: shang.gao@test2.server.com, username: shang.gao, host: test2.server.com

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 8PE: Write a program that reads in a line consisting of a students name, Social Security number, user ID,...
icon
Related questions
Question
Use regular expression to implement a function which accepts a passed string and check if it is a
valid email address. A program accepts user's input and calls the email validation function. If the
email is valid, print out the email, username and host. (Rule: word characters (a-zA-Z0-9_ or "w"),
dot, and hyphen are considered as valid characters in an email address, besides of one & only one
'@'.)
(Sample output as shown in the following figure is for demonstration purposes only.)
In [24]: runfile('C:/tmp/units/2020/SIT384-2020-1/portfolio/week2/
Task2.3P.py', wdir='C:/tmp/units/2020/SIT384-2020-1/portfolio/week2')
Please input your email address:test@
Not a valid email.
Please input your email address: shang.gao@test2.server.com
email: shang.gao@test2.server.com, username: shang.gao, host:
test2.server.com
Transcribed Image Text:Use regular expression to implement a function which accepts a passed string and check if it is a valid email address. A program accepts user's input and calls the email validation function. If the email is valid, print out the email, username and host. (Rule: word characters (a-zA-Z0-9_ or "w"), dot, and hyphen are considered as valid characters in an email address, besides of one & only one '@'.) (Sample output as shown in the following figure is for demonstration purposes only.) In [24]: runfile('C:/tmp/units/2020/SIT384-2020-1/portfolio/week2/ Task2.3P.py', wdir='C:/tmp/units/2020/SIT384-2020-1/portfolio/week2') Please input your email address:test@ Not a valid email. Please input your email address: shang.gao@test2.server.com email: shang.gao@test2.server.com, username: shang.gao, host: test2.server.com
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning