I've got a regex 开发者_如何学Gobut I'm not sure what the {1,}
stands for. Full regex is next: ^.{1,}$
.
^.{1,}$
matches strings that have atleast one of any(non-newline) character.
It is effectively same as: ^.+$
The general form of this limiting quantifier is:
{min,max}
which means minimum of min
repetitions but not more than max
repetitions.
You can drop the max
part thereby specifying only the lower limit on the number of repetitions and no bound on the upper limit: {min,}
In your case {1,}
means one or more repetitions.
{1,}
is the same as +
Which means 1 or more occurences
It means any character at least one time.
{1}
exactly one time{1,3}
between one and three times{1,}
at least one time
It stands for "one or more". The whole expression means "the beginning of a line (^
) with one or more ({1,}
) of any character (.
) on it through end of the line ($
)". Details here, but the {n,m}
syntax lets you specify exactly what range of matches you want to find. For instance, aj{2,4}
would match an "a" followed by 2-4 "j"s, so it would match "ajj", "ajjj", and "ajjjj" but not "aj" (too few "j"s).
{1,}
means: match at least once. The general syntax is: {n,}
- match n
or more times. It is documented here.
at least one or more than one
it's the same as the +
- operator
It means match repetitions of the previous character (i.e. any character) at least 1 time. It will basically match non-empty strings.
精彩评论