Home  >  Article  >  Backend Development  >  帮忙望看这2个正整数的表达式一样吗

帮忙望看这2个正整数的表达式一样吗

WBOY
WBOYOriginal
2016-06-13 12:25:50768browse

帮忙看看这2个正整数的表达式一样吗
/^[1-9]+$/

/^[1-9]*[1-9][0-9]*$/

这有区别么?

目的只是排除负数和0的正整数  只能是整数
------解决思路----------------------
第一个不允许有 0
第二个允许有 0
你说他们一样吗?
------解决思路----------------------
第一个都是1-9的数字
第二个尾数有可能是0的数字
------解决思路----------------------
第一个不许有0
第二个第一位数字不许是0

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn