Reputation: 439
I've been having no luck with a simple regex to match strings with 150 or less characters to alert my users of descriptions being too short.
These description values can contain any character/number with no specific pattern. Can someone with regex knowledge lend a hand?
Upvotes: 21
Views: 46366
Reputation: 27822
^.{0,150}$
This will match a whole string containing between 0 and 150 (inclusive) of any character. Though regular expressions are probably the wrong tool for this job.
Upvotes: 51