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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-20 12:46:40
Original
810 people have browsed it

/^[1-9]+$/

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

这有区别么?

目的只是排除负数和0的正整数  只能是整数


回复讨论(解决方案)

第一个不允许有 0
第二个允许有 0
你说他们一样吗?

第一个都是1-9的数字
第二个尾数有可能是0的数字

第一个不许有0
第二个第一位数字不许是0

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template