Can anybody tell me the difference between the *
and +
operators in the example below:
[<>]+
[<>]*
+
means one or more of the previous atom. ({1,}
)
*
means zero or more. This can match nothing, in addition to the characters specified in your square-bracket expression. ({0,}
)
Note that +
is available in Extended and Perl-Compatible Regular Expressions, and is not available in Basic RE. *
is available in all three RE dialects. That dialect you're using depends most likely on the language you're in.
Pretty much, the only things in modern operating systems that still default to BRE are grep
and sed
(both of which have ERE capability as an option) and non-vim vi
.