Regular Expressions

A regular expression is a string; a concatenation or disjunction of two regular expressions; or a regular expression quantified by *. +, or ?

REGEX ::= String | REGEX~REGEX | REGEX|REGEX | REGEX* | REGEX+ | REGEX?

A regular expression has a matches operation:

boolean matches(String text) // = true if text matches this

Labs

1.     Draw a UML class diagram for regular expressions.

2.     Implement the regular expression class.