|CIT597 Quiz 4 (Regex)
Please keep all answers short and to the point. Read each question and answer
it; don't add information that wasn't asked for.
- (50 points) Tell, in words, what each of the following patterns will match.
- (15 points) There are three ways you can use a regular expression to try
to match a string. What are those three ways? (Short answers, please.)
- (5 points) Write the regular expression \d+\.\d+ as a Java quoted String.
- (15 points) Write the Java statements (not a complete program!) to set
a boolean variable b to true if and only if the string s contains
- (5 points) By default, quantifiers are greedy. What does this mean?
- (10 points) If you apply the regular expression ([a-z]*)([0-9]+)([a-z]*)
to the string abc123xyz
- What characters are matched by the second capturing group?
- What characters are matched by the zeroth capturing group?