Question

In: Computer Science

Design a regular expression to filter out those numbers that are stored in the standard format  “+00-0-0000-0000”....

Design a regular expression to filter out those numbers that are stored in the standard format  “+00-0-0000-0000”.

Examples of valid results are:

+61-3-9214-4980 and +61-3-9285-7706

Solutions

Expert Solution

This can be done using '+' followed by 2 digits followed by '-' followed by a digit, followed by a '-', followed by 4 digits and again followed by a '-', followed by 4 digits.

This is given using the Regex :

\+\d{2}-\d-\d{4}-\d{4}

Screenshots:


Related Solutions

The phone numbers collected from questionnaire is a mess. Design a regular expression to filter out...
The phone numbers collected from questionnaire is a mess. Design a regular expression to filter out those numbers that are stored in the standard format         “+00-0-0000-0000” from the file called “Q1.txt” and redirect the results to the “cleaned.txt”. Note: Only +61-3-9214-4980 and +61-3-9285-7706 are the valid results.    [10 Marks]
Q1. 1. The phone numbers collected from questionnaire is a mess. Design a regular expression to...
Q1. 1. The phone numbers collected from questionnaire is a mess. Design a regular expression to filter out those numbers that are stored in the standard format "+00-0-0000-0000" from the file called "Q1.txt". Q1.txt +61392144979 +61 39214 4778 +61-3-9214-4980 +66(2)51574430 +61-3-9285-7706 Note: Only +61-3-9214-4980 and +61-3-9285-7706 are the valid results.
linux: Regular expressions file name: studentsyslog.txt Use a regular expression and grep or egrep to filter...
linux: Regular expressions file name: studentsyslog.txt Use a regular expression and grep or egrep to filter the file so the output displays only the items requested. Put your full command in the space provided 1.Show only the lines that end with an ellipses (3 dots) :
linux: regular expressions file name: studentsyslog.txt Use a regular expression and grep or egrep to filter...
linux: regular expressions file name: studentsyslog.txt Use a regular expression and grep or egrep to filter the file so the output displays only the items requested. Put your full command in the space provided. 1. Display only the lines that were written to the file between the times of 12:55 and 12:59 (inclusive). This is tricky. Don’t think of these times as numbers, think of these times as a series of characters (a 1 followed-by a 2 followed-by a colon,...
linux: regular expressions file name: studentsyslog.txt Use a regular expression and grep or egrep to filter...
linux: regular expressions file name: studentsyslog.txt Use a regular expression and grep or egrep to filter the file so the output displays only the items requested. Put your full command in the space provided. 1. Display only the lines that were written to the file between the times of 12:55 and 12:59 (inclusive). This is tricky. Don’t think of these times as numbers, think of these times as a series of characters (a 1 followed-by a 2 followed-by a colon,...
Add binary numbers 0 1010 1100+ 0 0011 1010 a. 0 1110 0110,NZVC= 0000 b. 1...
Add binary numbers 0 1010 1100+ 0 0011 1010 a. 0 1110 0110,NZVC= 0000 b. 1 0101 1011,NZVC= 1001 c. 0 0110 1111,NZVC= 0011 d. 1 0000 0110,NZVC= 1010 e. None of the above
A roulette wheel has numbers from 1 to 36 and two "special" numbers 0 and 00....
A roulette wheel has numbers from 1 to 36 and two "special" numbers 0 and 00. A $1 bet on a number will pay $36 if that number comes up. It is also possible to bet on two adjacent numbers, with a $18 payout if one of them spells, or four adjacent numbers, with a $9 payout. a) Let X be the total payout of a $1 bet on a number. Find E(X) and Var(X). b) Let Y be the...
Write the correct regular expression pattern for a phone number field with the format XXX-XXX-XXXX
Write the correct regular expression pattern for a phone number field with the format XXX-XXX-XXXX
how multiplication of two numbers (50 & 25) stored in RAM is carried out on the...
how multiplication of two numbers (50 & 25) stored in RAM is carried out on the Cortex-M4 processor using the MUL instruction.
Evaluate the given expression and express the results using the usual format for writing numbers (instead...
Evaluate the given expression and express the results using the usual format for writing numbers (instead of scientific notation) 32C2=
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT