Regex: match only letters WITH numbers

前端 未结 4 2159
梦谈多话
梦谈多话 2021-02-13 22:02

How can I create a regex expression that will match only letters with numbers?

I\'ve tried something like (?>[A-z]+)([a-z0-9]+).

4条回答
  •  猫巷女王i
    2021-02-13 22:24

    ^([a-Z]+[0-9]+|[0-9]+[a-Z]+)[a-Z0-9]*$

    and a simpler version inspired by TimPietzcker:

    ^([a-Z]+[0-9]|[0-9]+[a-Z])[a-Z0-9]*$

提交回复
热议问题