For each item, write a single regular expression that matches that item. Note that in ALL cases, the entire string must match without additional characters. A string of digits that contains only digits and contains exactly two fives. Examples of acceptable strings include: "15445", "55", "05563" The string should be rejected if it contains anything other than a digits.   2. A regular expression that matches a time expressed in the form "1:45 PM". The hours part must be a number from 1 to 12, the minutes range from 00 to 59, and the time must indicate either AM or PM (uppercase only and preceded by exactly one space).   3. A regular expression that matches a string representing a comma separated list of variable names such as:  hello, get_max, sum3 A variable name consists of letters, digits, and underscores but cannot start with a digit. There is exactly one space after every comma. No other spaces are allowed. Commas and spaces are not allowed before the first name and after the last name. An empty string is considered a match.

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter3: Performing Calculations With Formulas And Functions
Section: Chapter Questions
Problem 4.9CP
icon
Related questions
Question

For each item, write a single regular expression that matches that item. Note that in ALL cases, the entire string must match without additional characters.

  1. A string of digits that contains only digits and contains exactly two fives. Examples of acceptable strings include: "15445", "55", "05563"
    • The string should be rejected if it contains anything other than a digits.

 

2. A regular expression that matches a time expressed in the form "1:45 PM".

    • The hours part must be a number from 1 to 12, the minutes range from 00 to 59, and the time must indicate either AM or PM (uppercase only and preceded by exactly one space).

 

3. A regular expression that matches a string representing a comma separated list of variable names such as:  hello, get_max, sum3

    • A variable name consists of letters, digits, and underscores but cannot start with a digit.
    • There is exactly one space after every comma. No other spaces are allowed.
    • Commas and spaces are not allowed before the first name and after the last name.
    • An empty string is considered a match.
Expert Solution
steps

Step by step

Solved in 5 steps

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT