Reputation: 21
I need a regular expression to simply limit the number of characters in a textarea to 5000. If there are more secure regular expressions I could use, I am open to suggestions.
Thanks
Upvotes: 2
Views: 5941
Reputation: 4145
You will always get the job done with:
^[\s\S]{0,5000}$
\s
) or non-whitespace (\S
) -- i.e any possible characterUpvotes: 4
Reputation: 90007
^.{0,5000}$
should work. Although using a regular expression for this is probably an odd choice.
Upvotes: 8