The regular expression [abc]?
matches zero or one character that can be either a
, b
, or c
. Thus it does not match abc
. Positive matches would be the empty string, a
, b
, or c
.
On the other hand [abc]+
matches one or more characters that can be either a
, b
, or c
. Therefore, it can match the 3 character string abc
. Also aaa
or bbba
would match.
0
solved Behaviour of Java RegExp ‘?’ and ‘+’ [duplicate]