Regex for numbers only

后端 未结 18 2298
野性不改
野性不改 2020-11-22 03:29

I haven\'t used regular expressions at all, so I\'m having difficulty troubleshooting. I want the regex to match only when the contained string is all numbers; but with the

18条回答
  •  自闭症患者
    2020-11-22 04:25

    If you need to check if all the digits are number (0-9) or not,

    ^[0-9]+$
    

    1425 TRUE

    0142 TRUE

    0 TRUE

    1 TRUE

    154a25 FALSE

    1234=3254 FALSE

提交回复
热议问题