How to do Regexp validation in jQuery for 4x35 multi-line text

I need to make a multiline texbox for the user to enter four lines of 35 characters in each line. When I use the method that is in TextBox1, it works, but only for A-Za-z and all the other characters that I need to configure here:

$.mask = {
//Predefined character definitions
definitions: {
'9': "[0-9]",
'a': "[A-Za-z]",
'*': "[A-Za-z--0-9`~!@#$%^&*()_+-=\"]",
'#': "[A-Z0-9]"
}
};

This is not convenient, because I still don’t know which characters in which language will be needed in this text box.

I think that regexp inputmask, as in the TextBox2 example, is a good thing, but I don't really know much about JavaScript Regexp to create it (TextBox2 is Regexp - it's just, for example, I need another, of course).

jQuery(function($){
$("#TextBox1").mask("***********************************
\r\n***********************************
\r\n***********************************
\r\n***********************************");
$('#TextBox2').inputmask('Regex', {
regex: "^[0-9]{2}:[0-5][0-9]:[0-5][0-9]$"
});

Can anyone help create such a regular expression - multi-line text 4 lines 35 characters? Thanks for the help.

+4
1

, , 4 , 35 :

^(?:.{0,35}\r?\n){3}.{0,35}$

:

  • ^ -
  • (?:.{0,35}\r?\n){3} - 3 ...
    • .{0,35}\r?\n - 0 35 , ,
  • .{0,35}$ - 0 35 , , ($).

{min,max} . , .

+2

Source: https://habr.com/ru/post/1606359/


All Articles