Question: TASK: Write a python file that defines several variables containing compiled regular expressions, as follows: nospace = a regular expression that matches one or more
TASK: Write a python file that defines several variables containing compiled regular expressions, as follows:
nospace = a regular expression that matches one or more non-whitespace characters. There is a relatively straightforward solution that is 12 characters long.
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. Our reference solution is 32 characters long.
"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 (with the space after the comma if both: , but not ,). 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. Our reference solution is 50 characters long.
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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
