First this script test the strings N having chars from 3 to 5.
For multi language (arabic, Ukrainian) you Must use this
var regex = /^([a-zA-Z0-9_-\u0600-\u065f\u066a-\u06EF\u06fa-\u06ff\ufb8a\u067e\u0686\u06af\u0750-\u077f\ufb50-\ufbc1\ufbd3-\ufd3f\ufd50-\ufd8f\ufd92-\ufdc7\ufe70-\ufefc\uFDF0-\uFDFD]+){3,5}$/; regex.test('мшефн');
Other wise
the below is for English Alphannumeric only
/^([a-zA-Z0-9_-]){3,5}$/
P.S the above dose not accept special characters
one final thing the above dose not take space as test it will fail if there is space if you want space then add after the 0-9\s
\s
And if you want to check lenght of all string add dot .
var regex = /^([a-zA-Z0-9\s@,!=%$#&_-\u0600-\u065f\u066a-\u06EF\u06fa-\u06ff\ufb8a\u067e\u0686\u06af\u0750-\u077f\ufb50-\ufbc1\ufbd3-\ufd3f\ufd50-\ufd8f\ufd92-\ufdc7\ufe70-\ufefc\uFDF0-\uFDFD]).{1,30}$/;