Question: Using regular expressions, write a complete Perl script that, when given the input from a sample as shown below, displays ONLY the valid phone numbers

Using regular expressions, write a complete Perl script that, when given the input from a sample as shown below, displays ONLY the valid phone numbers found anywhere in the file. For this example assume a phone number is valid only if it is in the following form (where 9 represents anynumber):

(999)-999-9999

Sample Input:

this is a test 12345676867 (123)-456-7890 My number: (123)-555-1212 test 9999 test. A phone number ((123)-999-0000) exists on this line. There is no phone number ((123)-999+0000) on this line.

Sample Output:

(123)-456-7890 (123)-555-1212 (123)-999-0000

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!