Hi,
In a character class (between
[
and
]
), only
-
(the dash) is a special character;
?
and
|
would be treated as 'normal' characters.
Try this:
^(c|b)?$
Explanation about the
^
and
$
sign:
the
^
sign mentions the start of the
string
and the
$
mentions the end of the
string
.
Hope this helps.