Regex for checking if a string is strictly alphanumeric

前端 未结 10 2054
予麋鹿
予麋鹿 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:35

    In order to be unicode compatible:

    ^[\pL\pN]+$
    

    where

    \pL stands for any letter
    \pN stands for any number
    

提交回复
热议问题