I'm trying to create a JS Regular Expression to limit the amount of characters per line in an html text area. Ideally I would prefer to have it as a Javascript Regex as it's easier to use for our form validation engine.
I would like to create a regular expression that validates that a string has 10 characters per line, and a max of 3 lines
The idea would be to validate strings like the following ones:
01234567890
a
b
First line here has 11 characters so the whole string should be rejected/
a
b
c
d
This text has 4 lines so it should also be rejected.
I've tried with the following regex but is not working as expected:
^((?:\n)?[^\n]{0,10}){0,3}$
any clues on what I'm doing wrong?