Regular Expressions Q1 ECE684 Solved

30.00 $

Category: Tags: , , ,
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (1 vote)

Write a regular expression that matches people’s full names. Here are some example names:

• Quan Hongchan

• Philip Seymour Hoffman

• Dr. Nicki Washington

• Joseph Gordon-Levitt

• Ken Griffey, Jr.

• John von Neumann

It should not match single names like “Cher”, or non-name strings:

• Cher

• not a name

• happy feet

• The end

Run the provided tests (see README.md). You should be able to do per- fectly with a regular expression < 72 characters.

You are not expected to solve this problem generally; it is impossible. De- scribe in what situations your solution will fail.

Page 1 of 2

Regular Expressions

Q2

ECE 684

Develop a regular expression that matches all gerunds within a text.

For example, from the text harry loves to sing while showering. your expression should match only showering.

You may assume that:

• the input contains only lowercase letters, punctuation, and whitespace

• any non-letter character is not part of a word

(there will be no contractions, hyphenated words, etc.).

State any other assumptions that you would like to make.

Generate your own test cases and write a script testing your expression, in the style of test_name_matching.py. Describe in what situations your solution will fail.

You should turn in a document (.txt, .md, or .pdf) answering all of the red items above. You should also turn in Python scripts (.py) for each of the blue items.

Page 2 of 2

 

  • 1-Regular-Expression-afw292.zip