Question

What is a potential regex solution for an Array that contains these lines to find the...

What is a potential regex solution for an Array that contains these lines to find the first names and last names? (PYTHON)

John Doe

John, E. Doe

John, Doe E.

John, Doe

Jo hn, Doe Jr. (first name is "Jo hn")

John, Doe Doe III

John, E Doe

Homework Answers

Answer #1
^([a-zA-Z]{2,}\s[a-zA-Z]{1,}'?-?[a-zA-Z]{2,}\s?([a-zA-Z]{1,})?)

^                             // start of line
[a-zA-Z]{2,}    // will except a name with at least 2 characters
\s             // will look for blank space between name and surname
[a-zA-Z]{1,} // needs at least 1 Character
\'?-?               // possibility of **'** or **-** for double barreled and hyphenated surnames
[a-zA-Z]{2,}    // will except a name with at least 2 characters
\s?            // possibility of another whitespace
([a-zA-Z]{1,})? // possibility of a 2nd surname

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
7. A mineral contains lithium chromate and other inert compounds. In order to find out what...
7. A mineral contains lithium chromate and other inert compounds. In order to find out what the percent mass of lithium chromate is in the mineral you dissolve 6.294g of the mineral in water and add iron(III) nitrate to the solution. A solid forms and you continue to add iron(III) nitrate until the solid stops forming. You filter the solution, dry the solid you obtained and measure that the mass of solid formed is 1.596 g. What is the percent...
**please write code with function definition taking in input and use given variable names** for e.g....
**please write code with function definition taking in input and use given variable names** for e.g. List matchNames(List inputNames, List secRecords) Java or Python Please Note:    * The function is expected to return a STRING_ARRAY.      * The function accepts following parameters:      *  1. STRING_ARRAY inputNames      *  2. STRING_ARRAY secRecords      */ Problem Statement Introduction Imagine you are helping the Security Exchange Commission (SEC) respond to anonymous tips. One of the biggest problems the team faces is handling the transcription of the companies reported...
Python: Simple Banking Application Project Solution: • Input file: The program starts with reading in all...
Python: Simple Banking Application Project Solution: • Input file: The program starts with reading in all user information from a given input file. The input file contains information of a user in following order: username, first name, last name, password, account number and account balance. Information is separated with ‘|’. o username is a unique information, so no two users will have same username. Sample input file: Username eaglebank has password 123456, account number of BB12 and balance of $1000....
HIMT 345 Homework 06: Iteration Overview: Examine PyCharm’s “Introduction to Python” samples for Loops. Use PyCharm...
HIMT 345 Homework 06: Iteration Overview: Examine PyCharm’s “Introduction to Python” samples for Loops. Use PyCharm to work along with a worked exercise from Chapter 5. Use two different looping strategies for different purposes. Prior Task Completion: 1. Read Chapter 05. 2. View Chapter 05’s video notes. 3. As you view the video, work along with each code sample in PyCharm using the Ch 5 Iteration PPT Code Samples.zip. Important: Do not skip the process of following along with the...
Instructions​: You will find a file named findingNemo.m and another named nemo.txt. The first contains code...
Instructions​: You will find a file named findingNemo.m and another named nemo.txt. The first contains code which will read in strings from nemo.txt, then call Lab08(string) on each line of nemo.txt. Your job is to write Lab08.m. The Lab08 function will take in a string as input and will return an integer n as output. The value of n will be the nth word in the input string, where n is the location of the substring 'Nemo'. Please note that...
Use Python 3.8: Problem Description Many recipes tend to be rather small, producing the fewest number...
Use Python 3.8: Problem Description Many recipes tend to be rather small, producing the fewest number of servings that are really possible with the included ingredients. Sometimes one will want to be able to scale those recipes upwards for serving larger groups. This program's task is to determine how much of each ingredient in a recipe will be required for a target party size. The first inputs to the program will be the recipe itself. Here is an example recipe...
Answer the following questions from the information below a. What are the organization's marketing goals? b....
Answer the following questions from the information below a. What are the organization's marketing goals? b. What are the symptoms of the problem? In other words, which of the organization's marketing goals mentioned in section a., above are not being met? c. What is the organization's problem? Look at the symptoms and make a judgement about what their cause may be. Do not confuse symptoms with problems. Problems cause symptoms. d. Perform a SW/OT analysis: -What are the organization's internal...
INTELLECTUAL PROPERTY  Industrial property forms part of the broader concept of "intellectual property."  The...
INTELLECTUAL PROPERTY  Industrial property forms part of the broader concept of "intellectual property."  The objects of intellectual property are the creations of the human mind, the human intellect hence the expression "intellectual" property.  In a somewhat simplified way, one can state that intellectual property relates to pieces of information which can be incorporated in tangible objects at the same time in an unlimited number of copies at different locations anywhere in the world.  The property is...
The questions: 1. What type of technology Acme and Omega utilize to transform inputs into outputs?...
The questions: 1. What type of technology Acme and Omega utilize to transform inputs into outputs? 2. Which strategic choice (differentiation or cost leadership) suits best to Acme? Omega? Do these companies have clear strategic choices or do they stuck in the middle? 3. Based on all the contingencies which type of structure is more suitable for these companies; mechanistic or organic? please answer each question alone The Paradoxical Twins: Acme and Omega Electronics John F. Veiga Part! boom of...
1. What is an ISP (Integrated Service Provider) for supply chains? (1 point) A. A consultant...
1. What is an ISP (Integrated Service Provider) for supply chains? (1 point) A. A consultant agency which integrates the supply chain for companies B. A 2 PL or a 3PL, but not a 4PL C. A company supplying transportation and warehousing services D. A logistics service company specialized in suppling VAS (value added services) 2. What characterizes a 4 PL? (1 point) A. They are non-asset based and provides integrated services primarily supplied by asset based providers, for example...