Regex: Check if string contains at least one digit

后端 未结 9 2129
盖世英雄少女心
盖世英雄少女心 2020-12-09 07:40

I have got a text string like this:

test1test

I want to check if it contains at least one digit using a regex.

What would this reg

9条回答
  •  醉话见心
    2020-12-09 07:52

    This:

    \d+
    

    should work

    Edit, no clue why I added the "+", without it works just as fine.

    \d
    

提交回复
热议问题