Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write down the extended regular expression for following questions. E.g. Social

ID: 3747054 • Letter: W

Question

Write down the extended regular expression for following questions.

E.g. Social security number in the format of 999-99-9999. Answer: [0-9]{3}-[0-9]{2}-[0-9]{4}

a. Valid date format in the format of MMM-DD,YYYY. Note: the first character of the month is capitalized.

(e.g. May-09,2008 Apr-19,2018 Jan-01,2000)

b. An account name which is 8 to 15 characters long, begins with a letter or underscore, ends with a digit, and composed by letters, numbers, underscores and hyphens. (e.g. my_Name1, cat_2, One-1)

c. A single-line comment starting with a # and continuing until the end of the line. Note: only whitespace is allowed between the start of the line and the comment.

(e.g.      #This program outputs the string hello world.              )

d. Integers in the range between 00 and 99. (e.g. 0, 00, 01, 15, 55, 59,99)

Explanation / Answer

a.) ^[A-Z][a-z]*-d{2},d{4}

b.) ^[A-Za-z_][a-zA-Z0-9_-]{7,14}d

c.) ^[s]*#.*[^ ]$

d.) ^[0-9][0-9]?$

In what ever language you are using / may be replaced by .

Thank you.

Please Rate if you like my efforts. In case of any doubt, I am available in comments.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote