In regular expressions, what is the difference between ^[a-zA-Z]+$
and ^[a-zA-Z]*$
. Also would I be able to not include it at all, either with ^[
+
means 1 or more
*
means 0 or more
So an empty string is found by ^[a-zA-Z]*$
, but not by ^[a-zA-Z]+$
^[a-zA-Z]$
means EXACTLY one letter in the ranges a-z and A-Z.
a+
is a
, aa
, aaa
, ..., aaa...aaa
, etc
a*
is an empty string, a
, aa
, aaa
, ..., aaa...aaa
, etc
^a$
is only a
EDIT: you can also use ^a?$
to find 0 or 1 occurence of a
, so either an empty string or a