Regex that matches integers only

前端 未结 10 560
执笔经年
执笔经年 2020-11-30 09:56

I\'m currently using the pattern: \\b\\d+\\b, testing it with these entries:

numb3r 
2
3454 
3.214
test

I only want it to catc

10条回答
  •  爱一瞬间的悲伤
    2020-11-30 10:00

    ^(-+)?[1-9][0-9]*$ starts with a - or + for 0 or 1 times, then you want a non zero number (because there is not such a thing -0 or +0) and then it continues with any number from 0 to 9

提交回复
热议问题