Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a description of what the regex pattern describes in plain English. In the questions below, matches refers to whole-string matching (and not to matching

write a description of what the regex pattern

describes in plain English.

In the questions below, matches refers to whole-string matching (and not

to matching a substring).

4. Which of the following matches regex /abc|xyz/?

1) abc

2) xyz

3) abc|xyz

5. Which of the following matches regex /[a-z]+[\.\?!]/?

1) battle!

2) Hot

3) green

4) swamping.

5) jump up.

6) undulate?

7) is.?

6. Which of the following matches regex /[a-zA-Z]*[^,]=/?

1) Butt=

2) BotHEr,=

3) Ample

4) FIdDlE7h=

5) Brittle =

6) Other.=

7. Which of the following matches regex /[a-z][\.\?!]\s+[A-Z]/?

(\s matches any space character)

1) A. B

2) c! d

3) e f

4) g. H

5) i? J

6) k L

8. Which of the following matches regex /(very )+(fat )?(tall|ugly) man/?

1) very fat man

2) fat tall man

3) very very fat ugly man

4) very very very tall man

9. Which of the following matches regex /<[^>]+>/?

1)

2)

3)

4) <>

5)

10.

Write a regex to identify dates of the form dd/mm/yyyy.

I expect dd to range from 01 to 31, and mm to range from 01 to 12, and I

expect yyyy to range from 0001 to 9999 and in particular to not be 0000 (the Gregorian calendar predates this; see Year 0 and the invention of 0).

However, I do not expect you to cross-reference mm against dd or to

restrict yyyy, so that e.g. 31/02/0231 is fine.

Do not use backreferences or negative lookahead (so if your answer

contains ?!, then its not admissible for this question).

11.

Write a regex to identify dates of the form dd/mm/yyyy or

dd.mm.yyyy, but not using mixed separators such as dd/mm.yyyy.

You may use backreferences, negative lookahead, and other fancy

tricks, if convenient.

12.

(Unmarked) Explain whether a regex can identify correct bracketing,

as in ((a)) but not (((a).

13.

(Unmarked) Explain the relevance of the regex /Whiske?y/

14.

Write a regex for the set of even numbers without leading zeroes

(base 10; so the alphabet is [0-9]). Note that 0 and 2 and 10 and 20 are

even numbers without leading zeroes, and 00 and 02 and 1 and 01 are

not even numbers without leading zeroes. Check that your regex accepts

100 and 10012.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions