Expression or reg-ex for javascript or adobe livecycle tools

后端 未结 1 1596
生来不讨喜
生来不讨喜 2020-12-12 05:03

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])\\

1条回答
  •  心在旅途
    2020-12-12 05:14

    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("");
          }
        }
      });
    
    });
    
    

    0 讨论(0)
提交回复
热议问题