java - How to test if a String contains both letter and number

前端 未结 7 1247
轻奢々
轻奢々 2020-12-16 01:07

I need a regex which will satisfy both conditions.

It should give me true only when a String contains both A-Z and 0-9.

Here\'s what I\'ve tried:

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 01:14

    Try using (([A-Z]+[0-9])|([0-9]+[A-Z])) .It should solve.

提交回复
热议问题