Regex for checking if a string is strictly alphanumeric

前端 未结 10 2040
予麋鹿
予麋鹿 2020-12-01 12:02

How can I check if a string contains only numbers and alphabets ie. is alphanumeric?

10条回答
  •  無奈伤痛
    2020-12-01 12:33

    100% alphanumeric RegEx (it contains only alphanumeric, not even integers & characters, only alphanumeric)

    For example:

    special char (not allowed)
    123 (not allowed)
    asdf (not allowed)
    1235asdf (allowed)


    String name="^[^]\\d*[a-zA-Z][a-zA-Z\\d]*$";
    

提交回复
热议问题