regex to check the string contains only letter and numbers but not only numbers

后端 未结 10 1454
温柔的废话
温柔的废话 2021-02-06 11:31

I need a help with regex which checks the string contains only letter and numbers but not only numbers

Valid

* letters
* 1wret
* 0123chars
* chars0123
*          


        
10条回答
  •  温柔的废话
    2021-02-06 11:50

    ^[0-9]*[a-zA-Z]+[0-9a-zA-Z]*$
    

    translated: from the beginning, match 0 or more numbers, then match at least one letter, then match zero or more letters or numbers until the end.

提交回复
热议问题