You're escaping the first square bracket with the \
, which means the expression between the square brackets isn't treated as a character class. Remove the escaping and you should be OK:
"123".matches("[a-zA-Z0-9]{1,5}"
// Here -------^
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…