What will be the expression for restricting a user to enter either 5 lines or 375 characters in a scrollable text field?
I tried theese:
([A-Z])\\
Try this:^((.+\n){0,4}.+|.{1,375})$
$(document).ready(function() {
$("#text_string").focusout(function() {
var res, text_string = $("#text_string").val();
if (text_string != null) {
res = text_string.match(/^((.+\n){0,4}.+|.{1,375})$/);
console.log(res);
if (!res) {
$("#text_string").val("");
}
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<textarea name="" id="text_string" cols="30" rows="10"></textarea>