JavaScript regular detection only contains Chinese characters, numbers, letters, and underscores. It cannot start or end with underscores.
I encountered a problem with username detection. I checked it and summarized the following examples:
The code copy is as follows:
var reg = /^(?!_)(?!.*?_$)[a-zA-Z0-9_/u4e00-/u9fa5]+$/;
if (!reg.test(actual value string)) {
alert('Please enter 5-24 digit characters: supports Chinese, English, numbers, "_", Chinese is recommended');
}