var code="456"
var bol1 = /^[0-9]*$/.test(code)
var bol2 = /^[a-zA-Z]*$/.test(code)
var bol3 = /^[\u4e00-\u9fa5]*$/.test(code)
if (bol1 || bol2 || bol3) {
//
}
the above three regularities are used to judge only pure numbers or letters, or pure Chinese regularities, respectively, but three variables are used. Is there any way to merge the three regularities into one regular and simplify them with the "or" operator? For example, I tried
var code="as2dsd"
var bol1 = /^([0-9]*)|([a-zA-Z]*)|([\u4e00-\u9fa5]*)$/.test(code)
console.log(bol1)//true
but the above code is printed out as true, but what I need should be false
turn to God for help, thank you