Reputation: 6572
I am trying to create a regex only text space accepted and maximum 35 character.
^[a-zA-Z\s]*.{1,35}$
Upvotes: 1
Views: 63
Reputation: 4500
if I understand you right, here's what you need
^[a-zA-Z\s]{1,35}$
[a-zA-Z\s]
: whichever characters that is a letter or a space (newlines included, you might want to change that out: the \s
is what you could replace with
)^[a-zA-Z\s]*.{1,35}$
*
means 0 times or more the pattern that I wrote before. In this case, [a-zA-Z\s]
. .
means everything except \n
(a newline). And it was this pattern that had to be repeated at least once, and at the most, 35 times.Upvotes: 3