Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the following, we say things like t.j. should not match. This means that the full string t.j. wil not appear in the set of
In the following, we say things like t.j. should not match. This means that the full string t.j. wil not appear in the set of answers returned by finditer. Sub-parts of it might (e.g., t.j may match), but t.j. wont.
Write a python file called regexs.py that defines several variables containing compiled regular expressions, as follows: nospace = a regular expression that matches one or more non-whitespace characters. CS1110-001/smile should match, as should ! hi there should not match, nor should the empty string. quotation = a regular expression that matches text beginning and ending with a " , with no internal " , where the first and last character inside the quotes are not spaces. "hi there" should match " hi there" should not match, nor should "hi there " or "I said "hi" just now" . twonum = a regular expression that matches pairs of numbers, separated by a space, comma, or both. Accept both numbers with and without decimal places, and allow an optional preceding - on each number. If there is a decimal place, there must be at least one digit on each side of it. Additionally, each of the two numbers (with the - if present) should be a group after a match. 3,4 , 3.0, 4.5, and -3.14159265 1110 should all match. 3.4.5, 1, 1 2, and 3 - 4 should not match. likely_name = a regular expression that matches one common full name pattern: two or three consecutive capitalized runs of letters, separated by spaces. A capital letter and a period can serve as a name except in the last position. Thomas Jefferson should match, as should Edmund Jennings Randolph , J. Pierpont Finch , and T. Jefferson T Jefferson, Thomas J. , and Flannery O'Connor should not matchStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started