Assignment 1

Intro to Regexes


Due: 17 February


This assignment is meant to be a simple exercise in writing basic regexes.

You will not be required to write any code. Though you may, if you wish.

Part A


Directions: Write the regex that will capture all the values given in the group.
Some groups have additional instructions.

Group 1

1
14
1975.7

Group 2

49857
3425346.879
-4853.8c

For the following groups, don't be concerned with trying to match only valid Roman numerals. Also, your answers for Groups 3 - 5 should be distinct.


Group 3

henry iii
henry iv
henry v

Group 4

henry iii
Henry iv
Henry v

Group 5

henry iii
Henry iv
HENRY IV

Group 6

HENRY VIII       1509 - 1547
Edward vi 1547-53
MaRy I 1553-1557

For Group 7, your regex should match ONLY the 2 given cities,no others.


Group 7

constantinople
istanbul

For Group 8, the regex should NOT match nights, knighted, etc.


Group 8

night
knight



Part B


Directions: Now you will be given two simple regexes. These will be regexes that recognize normal patterns. Write two or three patterns that would be recognized by each regex.



\d+\s(M|G)Hz

\d\d\/\d\d\/\d\d(\d\d)?