go to previous page   go to home page   go to next page

Answer:

A{5}.*Z{5}

or your could have

AAAAA.*ZZZZZ


No Variables

Regular Expression
(Delimit with quotes)
String
(Delimit with quotes)

The subexpression X{n} means to match n number of the subexpression X. The number n must be a literal constant, like 5 or 23. It can't be a variable (because then the variable would be a counter, and REs don't have counters.) For example

[a-d]{5}

means to match five characters, where the characters are selected from 'a' through 'd'. The expression

a{X}z{X}

is not legal. (It is a failed attempt to match strings that start with any number of 'a' and end with the same number of 'z'.)


QUESTION 17:

Examine the expression     ([a-d]{5})+

Describe the strings that it matches.