string phoneNum =txtName.Text;
string MatchPhonePattern = @"\(?\d{3}\)?[. -]? *\d{3}[. -]? *[. -]?\d{4}";
Regex rx = new Regex(MatchPhonePattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
Match match = rx.Match(phoneNum);
if (match.Success)
lblDisplay.Text = "Valid number";
else
lblDisplay.Text = "not valid";
#include <iostream>
#include <regex>
#include <string>
using namespace std;
int main()
{
string userIn;
cout << "Enter a valid phone number (xxx-xxx-xxxx): ";
cin >> userIn;
regex phone_num_pat("(\\+?1[- ]?)?\\(?(\\d{3})\\)?[\\s-]?(\\d{3})[\\s-]?(\\d{4})");
if(regex_match(userIn, phone_num_pat))
cout << endl << userIn << " is a valid phone number" << endl;
else
cout << endl << userIn << " is not a valid phone number" << endl;
return 0;
}
************************************************************************ SCREENSHOT ***************************************************


C++ Write. Feel free to create a form/GUI or use console to create a regular expression...
Your mission in this programming assignment is to create a Python program that will take an input file, determine if the contents of the file contain email addresses and/or phone numbers, create an output file with any found email addresses and phone numbers, and then create an archive with the output file as its contents. Tasks Your program is to accomplish the following: ‐ Welcome the user to the program ‐ Prompt for and get an input filename, a .txt...
Regular Expression processor in Java Overview: Create a Java program that will accept a regular expression and a filename for a text file. The program will process the file, looking at every line to find matches for the regular expression and display them. Regular Expression Format The following operators are required to be accepted: + - one or more of the following character (no groups) * - zero or more of the following character (no groups) [] – no negation,...
For this discussion, you will be working with regular expressions. Please create a regular expression that requires passwords to begin with an uppercase letter, followed by five lowercase letters, followed by a one-digit number (0-9), and ending with one symbol (@, $, %, or &). You may use the index.htm file included with this discussion to test your regular expression. Note that the index.htm file contains HTML and JavaScript. To test your regular expression, simply assign your regular expression to...
Preliminaries For this lab you will be working with regular expressions in Python. Various functions for working with regular expressions are available in the re module. Fortunately, Python makes it pretty easy to check if a string matches a particular pattern. At the top of the file we must import the re module: import re Then we can use the search() function to test whether a string matches a pattern. In the example below, the regular expression has been saved...
This Exercise contains two classes: ValidateTest and Validate. The Validate class uses try-catch and Regex expressions in methods to test data passed to it from the ValidateTest program. Please watch the related videos listed in Canvas and finish creating the 3 remaining methods in the class. The regular expression you will need for a Phone number is: "^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$" and for an SSN: "^\\d{3}[- ]?\\d{2}[- ]?\\d{4}$" This exercise is meant to be done with the video listed in the...
Write a regular expression that captures the set of strings composed of 'a', 'b', and 'c', where any string uses at most two of the three letters (for example, "abbab" is a valid string, or "bccbb", or "ccacaa", but not "abccba": strings that contain only one of the three letters are also fine). Give a non-deterministic finite automaton that captures the regular expression from Using the construction described in class, give a deterministic version of the automaton. Repeat the previous...
Create a C program Evaluate an expression from console input and print its result. -The format of expressions: Number Symbol Number Symbol ... Symbol Number = Number -Number refers to an integer and Symbol refers to either + , -, *, or / - * and / have higher priority over + and -. E.g., given input “1+2*3+4=”, the result should be “11”; Hint: Use Polish Notation
JAVA help Create a class Individual, which has: Instance variables for name and phone number of individual. Add required constructors, accessor, mutator, toString() , and equals method. Use array to implement a simple phone book , by making an array of objects that stores the name and corresponding phone number. The program should allow searching in phone book for a record based on name, and displaying the record if the record is found. An appropriate message should be displayed if...
Write a C++ console application that reverses an array of characters, and counts the number of: Lower case characters (islower) Upper case characters (isupper) Digits (isdigit) Other (not one of previous) Create four global variables to hold these counts. Create function void count(char input[], char reverse[]) that takes as input two arrays: one that contains characters and another that will contain the reverse of that array. The function will reverse the input array and do the...
please use c++ language 1. Request three different integers from the console. a) Write a swap function that swaps two integer values. b) Write a sort function which accepts three integers as input then sorts them from largest to smallest using the swap function. c) Output the integers before and after sorting. Example 1 Output (input in bold italics) Enter three different integers: 3 2 4 3 2 4 4 3 2 Example 2 Output (input in bold italics) Enter...